行列转换函数


create table tmp_lzw_whytjnew nologging as
SELECT servnumber, TRANSLATE (LTRIM (text, ','), '*,', '*,') researcherList
FROM (SELECT ROW_NUMBER () OVER (PARTITION BY servnumber ORDER BY servnumber,
lvl DESC) rn,
servnumber, text
FROM (SELECT servnumber, LEVEL lvl,
SYS_CONNECT_BY_PATH (btjservnumber,',') text
FROM (SELECT servnumber, btjservnumber as btjservnumber,
ROW_NUMBER () OVER (PARTITION BY servnumber ORDER BY servnumber,btjservnumber) x
FROM tmp_lzw_whytj
ORDER BY servnumber, btjservnumber) a
CONNECT BY servnumber = PRIOR servnumber AND x - 1 = PRIOR x)
)
WHERE rn = 1
ORDER BY servnumber;

你可能感兴趣的:(行列转换)