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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL*Loader: How to populate foreign keys?

Re: SQL*Loader: How to populate foreign keys?

From: Todd Owers <toddo_at_gcr1.com>
Date: 1998/08/19
Message-ID: <6rfm7f$rg5$1@nntp.gulfsouth.verio.net>#1/1

I am aware of the CURRVAL and NEXTVAL pseudocolumns, but they are not accessible from inside SQL*Loader, are they? I am not accessing the sequence from a SELECT statement. Rather, I am accessing it from inside the SQL*Loader control file, as follows:

LOAD DATA
INFILE 'c:\input.txt'
INTO TABLE names
(nameid SEQUENCE,
last_name POSITION(01:15) CHAR,
first_name POSITION(15:25) CHAR,
... etc.

In my input file, I have records that need to go into a table that is a child of the names table. My problem arises when I want to re-use the sequence-generated value for nameid to populate a foreign key in a child table. If I were inserting last_name into the child table, I could easily reference POSITION(01:15) at the appropriate location. But how do I reference the sequence-generated value for nameid?

Todd

Madhu Cherukuri wrote in message <6rd96o$qqq_at_bgtnsc01.worldnet.att.net>...
>Try using the sequence.CURRVAL
>this will give you the same sequence number until
>you issue a select sequence.NEXTVAL statement
>This is valid in the same session
>
>HTH
>
>Madhu Cherukuri
>
Received on Wed Aug 19 1998 - 00:00:00 CDT

Original text of this message

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