Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- table_id (PK) number;
- table_1_id number;
- table_2_id number;
- table_id number;
- table_1_id number;
- table_2_id number;
- table_key number;
- table_key_data varchar2(15);
- table_1_id table_2_id table_id table_key table_key_data
- 1 123 12345 1 1111
- 1 123 12345 2 ABC
- 12345
- 23456
- 34567
- ..plus hundreds/thousands more
- table_1_id table_2_id table_id table_key table_key_data
- 1 123 12345 1 1111
- 1 123 12345 2 ABC
- 1 123 23456 1 1111
- 1 123 23456 2 ABC
- 1 123 34567 1 1111
- 1 123 34567 2 ABC
- ...plus remaining hundreds/thousands more.
- INSERT INTO TABLE_B (SELECT 1,123,TABLE_A.TABLE_ID, 1 for the first record and 2 for second record, CASE WHEN table_key = 1 THEN '1111' WHEN table_key = 2 THEN '1111111' END FROM TABLE_A WHERE TABLE_A.TABLE_ID NOT IN (SELECT table_id FROM TABLE_B)
Add Comment
Please, Sign In to add comment