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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Loading external data without specifying column names

Re: Loading external data without specifying column names

From: Chrean <nouvelle.gabriel_at_gmail.com>
Date: 14 Nov 2006 11:52:42 -0800
Message-ID: <1163533962.166106.267590@i42g2000cwa.googlegroups.com>


Thank you very much Renzo, seems it's the only way to achieve my goal.

Regards,
Gabriel

Renzo Zagni ha scritto:

> In SQL*Loader you need to specify the column names. Based on your
> description of the problem, I would suggest you to use SQL to
> "discover" the name of the columns and dynamically generate the control
> file and wrap it via shell script to make it more automated
>
> --Renzo
>
> Chrean wrote:
> > sybrandb ha scritto:
> >
> > > Chrean wrote:
> > > > Hello folks,
> > > > I'd need to do exactly what I wrote in subject.
> > > > Starting from a set of txt files, each containing data to be loaded in
> > > > my oracle db's tables, I have to write a script that loops on each file
> > > > and load it into the db.
> > > > I tried with sqlldr, but it requires that I specify every column name.
> > > > I don't want to do that, 'cause my routine will always find a match
> > > > between db columns and datafiles fields.
> > > >
> > > > Correct syntax is:
> > > >
> > > > load data
> > > > infile 'example.dat' "fix 11"
> > > > into table example
> > > > fields terminated by ',' optionally enclosed by '"'
> > > > (col1, col2)
> > > >
> > > > while I'd want something like this:
> > > >
> > > > load data
> > > > infile 'example.dat' "fix 11"
> > > > into table example
> > > > fields terminated by ',' optionally enclosed by '"'
> > > >
> > > > 'cause I already know my table will have 2 columns (and my datafile
> > > > will always have 2 fields, of course), not necessarily named "col1",
> > > > "col2".
> > > >
> > > > Thanks in advance,
> > > > Chrean
> > >
> > > Oracle is a *database*, NOT a GARBAGE BIN.
> > > Databases are *DESIGNED*!!!
> > >
> > > --
> > > Sybrand Bakker
> > > Senior Oracle DBA
> >
> > That's not what I meant.
> > I don't have to CREATE tables, but to append data to existent ones,
> > thus column names are not significant to me.
> > And since my schema will not always be the same for each customer (this
> > means, a table may have 3 columns in a customer implementation while 4
> > in another one), I'd just need to import data as they are.
> > I can explain the reason why I have to follow such steps, if you'll ask
> > me to.
> >
> > Thanks again.
Received on Tue Nov 14 2006 - 13:52:42 CST

Original text of this message

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