Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> INSERT INTO Child Tables

INSERT INTO Child Tables

From: <melliott42_at_yahoo.com>
Date: 24 Jan 2006 06:58:05 -0800
Message-ID: <1138114685.754417.26580@g43g2000cwa.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US