I am trying to migrate some code from a postgresql db to an Oracle db. There is a portion of the code that uses generate_series() which is exclusive to postgres.
SELECT
ITEM
generate_series(1, ITEM.QTY:: INTEGER ) as TABLE_ID
FROM TABLE
This creates duplicate records for each ITEM based on the ITEM.QTY value. If the ITEM has a qty of 4 then it will return 4 rows for that ITEM each with a different TABLE_ID of 1, 2 ,3 , and 4.
For example, if the original data looks like this:
ITEM | ITEM.QTY |
---|---|
item1 | 4 |
The select statement with generate_series will return:
ITEM | ITEM.QTY |
---|---|
item1 | 1 |
item1 | 2 |
item1 | 3 |
item1 | 4 |
What would be the ORACLE SQL equivalent way of doing this?