SQL LOADER Challenge [message #74141] |
Mon, 20 September 2004 01:18 |
cecil
Messages: 3 Registered: June 2002
|
Junior Member |
|
|
Hi
I intend to load a file which comes with a header and trailer. I dont wish to load the header and trailer. Am able to do so with the following ctl file. Only problem is I also need to set the record number when i load the table. This am able to do so using the "recnum" feature. Only problem is that the header is also being counted and hence my target table has record numbers starting with 2 instead of 1. ctl file looks as follows
Load Data
APPEND INTO TABLE TBL_TEST
WHEN (01) <> 'H' AND (01) <> 'Z' AND (01)<> ' '
TRAILING NULLCOLS
(BUSINESSDAY CHAR TERMINATED BY "~",
COUNTRY CHAR TERMINATED BY "~",
RECNUM recnum)
Any help will be appreciated
|
|
|
Re: SQL LOADER Challenge [message #74143 is a reply to message #74141] |
Mon, 20 September 2004 06:09 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
Why don you just remove the FIRST and LAST lines in your
datafile prior to loading it?
Options are flexible
#
#let this be the datafile
#
bash-2.03$ cat treat.txt
1,first line
2,second line
3,last line
#
# I have script that takes an input filname
# the out put is shown ( firt and last lines truncated).
# Now you can use this file as input to SQL*LOADER.
bash-2.03$ treat treat.txt
2,second line
#
# THis is the script
#
bash-2.03$ cat treat
#!/usr/bin/bash
#now delete the first line (Header)
sed '1,1d' $1 > /tmp/temp_$1.1
#now delete the last line (tail)
sed '$d' /tmp/temp_$1.1 > /tmp/temp_$1.2
cat /tmp/temp_$1.2
|
|
|