Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN
- FOR single_row IN (
- SELECT *
- FROM MY_TABLE)
- LOOP
- --iterate through columns of 'single_row'
- --for each nullable column do insert with real current column name and column value)
- --I assume each column is nullable except of ID
- INSERT INTO ANOTHER_TABLE VALUES (single_row.id, column_name, column_value);
- END LOOP;
- END;
- ID|ABC1|DA23|EE123|...
- 1|123|456|789|...
- 2|321|654|987|...
- MY_TABLE_ID|COLUMN_NAME|COLUMN_VALUE
- 1|ABC1|123
- 1|DA23|456
- 1|EE123|789
- ... other columns from row 1
- 2|ABC1|321
- 2|DA23|654
- 2|EE123|987
- ... other columns from row 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement