在使用oracle数据库的时候,正常情况下,字段起名都要避开关键字。
但由于我用的别人的表,没法让人家改,所以遇到了字段名与关键字重复,遇到的有time,tagname,desc 这三个。
直接用的话,数据库会报错 ORA-00936: missing expression。
解决方法:
将字段改为大写(首字母必须大写,其他可以看情况定),且前后加双引号
例如:
普通查询语句
select "Time","TagName","DESC" from live
搜索框查询
<include refid="select"/>
<where>
<if test="desc != null and desc != ''"> and "DESC" like concat(concat('%', #{desc}), '%')</if>