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 Question

Re: SQL*Loader Question

From: Keith E. Moore <kmacs_at_gandalf.kmacs.com>
Date: 1998/02/18
Message-ID: <slrn6ekeev.1m0.kmacs@gandalf.kmacs.com>#1/1

On Tue, 17 Feb 1998 23:51:07 GMT, Alan Cannon <acannon_at_webzone.net> wrote:
>Does anyone know how to (or if it's possible at all) use SQL*Loader to load
>a delimited ASCII file into a table without loading all the fields from the
>input file. It seems like this should be possible to me.
>
>

We just had a similar problem and were unable to find an option for this, we ended up using an awk script as a filter:

(Assuming '|' delimited)
-- stripflds.awk --
BEGIN {
  FS="|"

  fieldsToSkip[5] = "skip"
  fieldsToSkip[8] = "skip"
  fieldsToSkip[15] = "skip"

}
{
  for( i=1; i<NF; i++ ) {
    if( !(i in fieldsToSkip) ) {
      printf( "%s|", $(i))
    }
  }
 printf("\n")
}
-- end --
If it's a large file and you don't want to generate a copy of it you can use this trick:

bash$> mknod impnode p (or mknod -p impnode in some cases)

bash$> sqlldr user/pass myload.ctl data=impnode

bash$> awk -f stripflds.awk myinputfile > impnode

bash$> rm impnode

If someone does know how to have sqlldr skip a field, I would like to know.

Hope this helps

-- 
-- Keith Moore
   President
   KMA Computer Solutions, Inc.

-- 
/*----C/C++--Java--VB--Pro*C--SQL--OCI--Java--Delphi--ODBC--COBOL-----* 
 *        When the project must be saved at all costs:                *
 * KMA Computer Solutions, Inc.   Project Troubleshooting/Recovery    *
 *---------Linux---AIX---HPUX---SYSV---Novell---NT---OS/2---'95-------*/
Received on Wed Feb 18 1998 - 00:00:00 CST

Original text of this message

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