日期:2014-05-17 浏览次数:20965 次
SELECT
so.process_instance_id,
(
SELECT LTRIM(
MAX(SYS_CONNECT_BY_PATH(wo, ',')), ',')
FROM (SELECT wo, RN, LEAD(RN) OVER(ORDER BY RN) RN1
FROM (SELECT wo,
ROW_NUMBER() OVER(ORDER BY wo DESC) RN
FROM (
SELECT
wi.workstep_name wo
FROM
workitem wi
WHERE
wi.status IN('I_ASSIGNED','I_AVAILABLE')
and wi.process_instance_id=so.process_instance_id
)
)
)
START WITH RN1 IS NULL
CONNECT BY RN1 = PRIOR RN
) test
FROM
serviceordercpemacd so,
processinstance pi
WHERE
so.process_instance_id=pi.process_instance_id
SELECT
&