Home » RDBMS Server » Server Utilities » sqlldr: Loading Data into Multiple Tables
sqlldr: Loading Data into Multiple Tables [message #70818] Sat, 27 July 2002 04:26 Go to next message
Eric Hubert
Messages: 2
Registered: July 2002
Junior Member
Hi,

I'd like to extract multiple logical records from a single input record.
The problem is, I have no information about the primary key in the data file.
The loader could fill my primary key using the SEQUENCE function. But how can I reference this column in the INTO TABLE statements for the detail inserts?

Here a simplified data file:
Henry Ford 012 114 013 115
Mercedes Benz 017 117 010 120

Two tables should be filled:
t_mig_names
id number(9),
firstname varchar2(30),
lastname varchar2(30)

t_mig_names_values
id number(9),
name_id number(9), -- foreign key
value1 number(5),
value2 number(5)

Having a primary key in the data file this task would be quite easy to solve according to the SQL*Loader Control File Reference.

Thanks for your help!

Bye,
Eric
Re: sqlldr: Loading Data into Multiple Tables [message #70819 is a reply to message #70818] Sat, 27 July 2002 12:18 Go to previous message
Eric Hubert
Messages: 2
Registered: July 2002
Junior Member
Using RECNUM for the primary and foreign key seems to solve my problem.
Nevertheless I noticed something strange. The order in which records are inserted into the detail table isn't the same as of the blocks in my physical record respectively not the same as the order of my INTO TABLE statements.
Why? How to change this behaviour?
I need to access the records in exactly the same order.
So my workaround is to add a new column to the detail table and insert consecutive numbers during the load via a CONSTANT in each INTO TABLE statement.
Afterwards I can sort my data using the consecutive number - not very nice, but it works.
Better solutions are greatly appreciated!
Previous Topic: connection pool using proC/C++
Next Topic: file structure
Goto Forum:
  


Current Time: Sat May 04 04:16:52 CDT 2024