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

Home -> Community -> Mailing Lists -> Oracle-L -> SQLLDR - ID in header rec only

SQLLDR - ID in header rec only

From: Knight, Jon <jknight_at_concordefs.com>
Date: Tue, 19 Apr 2005 15:44:22 -0500
Message-ID: <17ECCBDCF27C544583F2CAD928F953260221FBCA@memex1.corp.cefs.int>


All,
  I'm stumped. We're trying to load some data that we receive in the following format:

Header Record 1
Header Record 2
Detail Record 1
Detail Record 2
...
Detail Record N
Trailer Record

  Our first thought was to use multiple "insert into" clauses in the .ctl file to insert the header records and detail records into separate tables. Unfortunately, the detail records don't contain the header ID! Next we tried the CONTINUEIF clause to concatenate into one logical record so all the subsequent "insert into" clauses would have access to the header ID. Below is a script that demonstrates our efforts. This works as expected, however our particular file may potentially contain thousands of detail records for each header/trailer. So the .ctl file would get rather unwieldy. Even if we could get a huge .ctl file to work, we would still have the performance hit of discarding all those empty records from the multiple "insert into" clauses on short logical records.

  What seems ideal is to skip the CONTINUEIF clause and find some way to ask SQLLDR to remember the ID from the header record and use it while inserting each detail record, until reaching a trailer or a new header record. But, my research has failed to discover any such a construct. It's probably right there in front of me, so whoever can see it gets to smear egg on my face.

  Any suggestions are welcome. Thanks for looking.

Thanks,
Jon Knight

create table family (
  id number(10)
 ,last_name varchar2(30)
)
/

create table family_members (
  fam_id number(10)
 ,first_name varchar2(30)
)
/

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Apr 19 2005 - 16:48:33 CDT

Original text of this message

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