Oracle, comma separated list to rows for every row in table

47 Views Asked by At

I have data looking like this:

ID      CONTENT
1474    1442,1522,1420
1472    1442,1419
1473    1442,1418
1674    1442,1493,1523,1421

I want output like

ID    ID2
1474  1442
1474  1522
1474  1420

etc. etc.

Im trying to use connect by:

SELECT id,regexp_substr(content, '[^,]+', 1, LEVEL) AS doc_id,level
FROM   (
       ...
       )
CONNECT BY  regexp_count(content, '[^,]+') >= LEVEL

But i'm missing something clearly, because instead of 11 rows (in this case), i've got dozens.. Can anyone help?

Regards

0

There are 0 best solutions below