Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> INSERT INTO Child Tables
Hello,
In an Oracle 9i database I have two tables (say PARENT and CHILD ). The CHILD table uses the field station_key for both it's Primary Key (PK) and Foreign Key (FK) for the PARENT table . I cannot change to table structure.
PARENT
parent_id NUMBER (PK)
date_time DATE
station_key NUMBER (UNIQUE)
CHILD
station_key NUMBER (PK) <=== References PARENT.station_key via FK
CONSTRAINT
value VARCHAR2
I have created a duplicate of the above tables (say PARENT_AUX, CHILD_AUX ) and wish to perform an INSERT INTO to grab all the data for a certain date range.
This works for the PARENT (because they both have a date_time field): INSERT INTO parent_aux SELECT * FROM parent WHERE date_time >= to_date(to_char(sysdate - 10),'yyyymmddhh24'), yyyymmddhh24');
How can I grab the matching data for the CHILD tables?
Thanks for spelling this out,
Michael42 Received on Tue Jan 24 2006 - 08:58:05 CST