下面sql语句是MySQL写法
select count(*) from sys_dept where status = 0 and del_flag = '0' and
find_in_set(#{deptId}, ancestors)
find_in_set 函数的功能就是查询前一个字符串在后一个字符串中是否存在,
如果存在就返回空,如果存在就返回,前一个字符串在后一个字符串所在的位置
在Oracle环境下运行则会出现这样的错误
ORA-00920:无效的关系运算符
Oracle中的instr函数跟find_in_set函数的功能类似,用之替换
在Oracle中的正确写法为
select count(*) from sys_dept where status = 0 and del_flag = '0'
and instr(#{deptId}, ancestors)>0