CodePudding user response:
Use regexp_substr apart, sys_connect_by_path even go back againCodePudding user response:
WITH T1 AS (SELECT 'AA1' A, '00,01,03 B FROM DUAL UNION ALL
SELECT 'bb2' A, 'by' 01 B FROM DUAL UNION ALL
SELECT 'C1' A, '03 B FROM DUAL),
T2 AS (
SELECT '00' A, B 'liquidity loans FROM DUAL UNION ALL
SELECT '01' A, 'project loans' B FROM DUAL UNION ALL
SELECT '02' A, B 'term loan FROM DUAL UNION ALL
SELECT the '03' A, B 'trust loans FROM DUAL)
. SELECT A T1, A T1. B, LISTAGG (T2), B ', ') WITHIN GROUP (ORDER BY 1) SS
The FROM T1 LEFT JOIN T2 ON T1. B LIKE '%' | | T2. A | | '%' GROUP BY T1. A, T1. B ORDER BY 1, 2;