--b.resdepartment保存的是是逗号分隔的员工ID,例如‘99001,99002,99003‘
--sprt_orgobject 表保存了每个员工ID对应的员工姓名
--wm_concat函数在11g及以后将无法正常使用
select
(select wm_concat(orgname) from sprt_orgobject where orgid in (
select replace(regexp_substr(b.resdepartment,‘[^,]+‘,1,level),‘,‘,‘ ‘) c1 from dual
connect by level<=length(b.resdepartment)-length(replace(b.resdepartment,‘,‘,‘‘))+1)) 员工姓名
from buy_ys_productelements b
时间: 2024-11-10 12:59:37