Hello,
I try to load the content of a file into two tables with sqlloader.
The first table has an indentifier which is obtains with an SEQUENCE,
The second table has a field which contains the ident of the first table has a foreign key
Everything is ok except the management of the foreign key for the second table : sqlloader begins by loading the first table and load after the second table.
So the value of the foreign key in the second table is load with the last value of the ident of the first table.
What i seek is an execution of sqlloader line by line of the data file : First line of data into each table, then second line of data... This way i could obtain the current value of the sequence into the foreign_key.
How can i do this ?
Details :
First my file 'data.dat' :
Item1 data1
Item2 data2
Item3 data3....
which is load with theses instructions for sqlloader :
LOAD DATA 'data.dat'
INTO TABLE myfirsttable
FIELDS TERMINATED BY WHITESPACE
{
FIRSTTABLE_ID 'MY_SEQUENCE.nextval'
...other instructions to load data in the first table
}
INTO TABLE mysecondtable
{
FIRSTTABLE_ID_FK 'MY_SEQUENCE.currval'
...other instructions to load data in the second table
I try to load the content of a file into two tables with sqlloader.
The first table has an indentifier which is obtains with an SEQUENCE,
The second table has a field which contains the ident of the first table has a foreign key
Everything is ok except the management of the foreign key for the second table : sqlloader begins by loading the first table and load after the second table.
So the value of the foreign key in the second table is load with the last value of the ident of the first table.
What i seek is an execution of sqlloader line by line of the data file : First line of data into each table, then second line of data... This way i could obtain the current value of the sequence into the foreign_key.
How can i do this ?
Details :
First my file 'data.dat' :
Item1 data1
Item2 data2
Item3 data3....
which is load with theses instructions for sqlloader :
LOAD DATA 'data.dat'
INTO TABLE myfirsttable
FIELDS TERMINATED BY WHITESPACE
{
FIRSTTABLE_ID 'MY_SEQUENCE.nextval'
...other instructions to load data in the first table
}
INTO TABLE mysecondtable
{
FIRSTTABLE_ID_FK 'MY_SEQUENCE.currval'
...other instructions to load data in the second table