WITH TEST AS(
SELECT 'AAA','3' FROM dual UNION ALL
SELECT 'BBB','2' FROM dual UNION ALL
SELECT 'CCC','4' FROM dual
)
结果:
AAA_1
AAA_2
AAA_3
BBB_1
BBB_2
CCC_1
CCC_2
CCC_3
CCC_4
------解决方案--------------------
WITH TEST AS
(SELECT 'AAA' c1, '3' c2
FROM dual
UNION ALL
SELECT 'BBB', '2'
FROM dual
UNION ALL
SELECT 'CCC', '4' FROM dual)
select c1
------解决方案--------------------
'_'
------解决方案--------------------
level
from test
connect by level <= to_number(c2)
and c1 = prior c1
and prior dbms_random.value is not null;
------解决方案--------------------
WITH TEST AS
(SELECT 'AAA' c1, '3' c2 FROM dual UNION ALL
SELECT 'BBB', '2' FROM dual UNION ALL
SELECT 'CCC', '4' FROM dual)
SELECT DISTINCT c1
------解决方案--------------------
'_'
------解决方案--------------------
LEVEL cc FROM test
CONNECT BY level<=to_number(c2) ORDER BY cc