Re: Sqlloader: All database in one single plain text file

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 26 Feb 2004 07:39:47 -0800
Message-ID: <2687bb95.0402260739.57d4b603_at_posting.google.com>


loktai_at_engineer.com (BadMan!) wrote in message news:<8e5d4aee.0402251004.5fbc6c7f_at_posting.google.com>...
> Hi all,
>
> I'm trying to use sqlloader to import a database with multiple
> different tables which has been exported to one single plain text
> file. No fixed lenght. Let's say database.txt is something like
>
> fruits,orange,orange
> fruits,banana,yellow
> fruits,pear,green
> users,John Doe,25,34,26th upper street,0, 12-2-2003
> users,Fred Flinstone, 24,5,14th Downing Lane,1,1-7-2002
>
>
>
> żIs it possible to try an approach based on WHEN statements? I mean:
>
> LOAD DATA
> INFILE database.txt
> FIELDS TERMINATED BY ','
> WHEN (first field is 'fruits')
> (name, color)
> WHEN (first field is 'users')
> (name, age, visits, address, active, since)
>
> I only whant to know if it is possible or not, but will wellcome
> advice in ctl file sintax.
>
> Thanks in advance and best regards

From looking at the notes and example in the 9.2 Utilities manual it does not appear that sqlldr is really designed to load different sets of data into multiple tables. The only expample takes portions of the same input and places it into different tables, but the input data format does not change.

It should however be easy to write a C program or Shell script to split the input file into one file per table based on the first delimited parameter being the table name: fruits.dat, users.dat, etc.....

Perhaps a true sqlldr expert will see your post and have time to respond if there is any practical way to feed multiple layouts to multiple tables in a single job.

HTH -- Mark D Powell -- Received on Thu Feb 26 2004 - 16:39:47 CET

Original text of this message