
December 16th, 2008, 04:00 PM
|
|
Authorized User
|
|
Join Date: Oct 2006
Location: , , .
Posts: 31
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Basic INSERT question for PL-SQL
I have two tables, TABLE_OLD and TABLE_NEW, like so:
Code:
TABLE_OLD
PART_NUM Flag1 Flag2 Flag3
===============================
223 1 0 0
344 0 0 1
877 0 1 1
878 1 0 0
TABLE_NEW
PART_NO Flag1 Flag2 Flag3
===============================
223 NULL NULL NULL
344 NULL NULL NULL
877 NULL NULL NULL
878 NULL NULL NULL
I want to insert the data from the three columns in the old table, Flag1, Flag2, and Flag3, into their corresponding columns in the new table for each matching part number. The new table has matching columns of the same data type, the cells are just empty.
Most if teh INSERT examples I have seen so far deal with simple inserts of hard-coded data, not this sort of situation. Is the query I will want to run something like this?:
Code:
INSERT INTO TABLE_NEW.Flag1 TABLE_NEW.Flag2 TABLE_NEW.Flag3 FROM TABLE_OLD.Flag1 TABLE_OLD.Flag2 TABLE_OLD.Flag3 WHERE TABLE_OLD.PART_NUM=TABLE_NEW.PART_NO;
Thanks for any help.
|