1、方法一:
SELECT regexp_substr('161,83,66,81','[0-9]+',1,LEVEL) FROM dual CONNECT BY level <= length('161,83,66,81') - length(regexp_replace('161,83,66,81',',','')) + 1;
另附流程备份如下(注意最后的分号在流程中是否需要):
SELECT ID ,DEPARTMENTID ,LASTNAME FROM HRMRESOURCE WHERE LOGINID IS NOT NULL AND DEPARTMENTID IN (SELECT regexp_substr(t.deptid,'[0-9]+',1,LEVEL) FROM (SELECT (CASE to_char(DEPARTMENTID) WHEN to_char(161) THEN 161||','||81||','||66||','||83 ELSE to_char(DEPARTMENTID) END ) deptid FROM HRMRESOURCE WHERE DEPARTMENTID = 161) t CONNECT BY level <= length(t.deptid) - length(regexp_replace(t.deptid,',','')) + 1) AND LASTNAME NOT LIKE '%离职%';
来源:博客园
作者:admin_jh
链接:https://www.cnblogs.com/suhfj-825/p/11510283.html