I have a table like this
parent_item  child_item  quantity
          A           B         2
          A           C         3
          B           E         1
          B           F         2
And would like to split this in multiple lines based on the quantity
parent_item  child_item  quantity
         A            B         1
         A            B         1
         A            C         1
         A            C         1
         A            C         1
         B            E         1
         B            F         1
         B            F         1
The column quantity (1) is not really necessary.
I was able to generate something with the help of connect by / level, but for large tables it's very very slow.I'm not really familiar with connect by / level, but this seemed to work, although I can't really explain:
select distinct parent_item, level LEVEL_TAG, child_item, level||quantity
FROM table
CONNECT BY quantity>=level
order by 1 asc;
I found similar questions, but in most cases topicstarter want's to split a delimited column value in multiple lines (Oracle - split single row into multiple rows)
What's the most performant method to solve this?
Thanks
 
     
    