今天做bootstrap的treeview,要求输入节点ID id,父节点ID pid,文本 text
但是执行的sql别名都是大写,所以找了下orcl的别名如何小写的问题
代码如下:
SELECT T.FUN_ID "pid",T1.FUN_ID id,T1.FUN_NM text,T1.FUN_ID, T1.FUN_CD, T1.FUN_NM
FROM T_SM_FUNCTIONS T, T_SM_FUNCTIONS T1
WHERE T.FUN_ID = T1.PAR_FUN_ID
AND T.FUN_ID = '5'
AND T1.FUN_ID <> '5'
别名加上双引号即别名显示为小写
如果是在java中 则用转义的方式,如下
String sql = "SELECT T.FUN_ID \"pid\",T1.FUN_ID \"id\",T1.FUN_NM \"text\",T1.FUN_ID, T1.FUN_CD, T1.FUN_NM"
+" FROM T_SM_FUNCTIONS T, T_SM_FUNCTIONS T1"
+" WHERE T.FUN_ID = T1.PAR_FUN_ID"
+" AND T.FUN_ID = '"+funid+"'"
+" AND T1.FUN_ID <> '"+funid+"'";
List<?> list = this.queryForList(sql);
return list;