Home » RDBMS Server » Server Utilities » Urgent! - WHEN clause only works for the 1st WHEN in sqlloader
Urgent! - WHEN clause only works for the 1st WHEN in sqlloader [message #73634] Tue, 08 June 2004 15:20 Go to next message
Sunitha
Messages: 16
Registered: January 2000
Junior Member
Hi,

I need to load into different columns in a same table based on the values of a column called LIST_NBR.

My current datafile has the following format:

4128002072223683,20026,20030930,20031231,11
4128002072584977,20417,20030930,20031231,11
4128002080241636,20417,20030930,20031231,11

The last two digits are LIST_NBR (Varchar2(5)) on the database. If i use '11' in the first WHEN clause, it works fine!!, but, If i use '11' in the WHEN clause somewhere in the middle or at the end, it doesn't load anything. I says none of the WHEN Clauses were satisfied.

Following is my control file:

LOAD DATA
INFILE  '$STAGINGDIR/OLP_TST_LST.DAT'
BADFILE '$STAGINGDIR/OLP_TST_LST.BAD'
TRUNCATE
INTO TABLE  EPIMART.EXT_TST_LST_test
WHEN (LIST_NBR = '1')
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
ACCT_NBR                CHAR            ,
LST01_CELL_VAL_CD       CHAR            ,
LST01_CELL_EFF_DTE      DATE "YYYYMMDD" ,
LST01_CELL_EXP_DTE      DATE "YYYYMMDD" ,
LIST_NBR                CHAR
)
------*********************************************
INTO TABLE  EPIMART.EXT_TST_LST_test
WHEN (LIST_NBR = '2')
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
ACCT_NBR                CHAR            ,
LST02_CELL_VAL_CD       CHAR            ,
LST02_CELL_EFF_DTE      DATE "YYYYMMDD" ,
LST02_CELL_EXP_DTE      DATE "YYYYMMDD" ,
LIST_NBR                CHAR
)

 

The LIST_NBR could be different each time. So, I need to be able to get the WHEN clauses for LIST_NBR 1 thru 25 working, irrespecitve of which WHEN clause is listed first.

If any one has any thoughts, I'd really appreciate it.

Thanks,

Sunitha.
Re: Urgent! - WHEN clause only works for the 1st WHEN in sqlloader [message #73635 is a reply to message #73634] Tue, 08 June 2004 22:41 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9097
Registered: November 2002
Location: California, USA
Senior Member
I have found that multiple into table and when clauses don't seem to work properly with delimited files. If you can get your $STAGINGDIR/OLP_TST_LST.DAT' in fixed position format and modify your control file to match, it may solve your problem.
Re: Urgent! - WHEN clause only works for the 1st WHEN in sqlloader [message #73639 is a reply to message #73635] Wed, 09 June 2004 19:40 Go to previous messageGo to next message
Sunitha
Messages: 16
Registered: January 2000
Junior Member
thanks barbara.
I guess we cannot ask for a fixed position format file.
We have to work with a comma delimited file, so, I guess i have to find other ways to do it.

thanks a bunch for your input.. at least I won't waste my time trouble shooting WHEN clause with comma delimited file.
Re: Urgent! - WHEN clause only works for the 1st WHEN in sqlloader [message #73640 is a reply to message #73639] Wed, 09 June 2004 21:16 Go to previous message
Barbara Boehmer
Messages: 9097
Registered: November 2002
Location: California, USA
Senior Member
You can always load the delimited data into a table, then spool that data to a file n fixed position format. Or, better yet, load the data into a staging table, then just distribute the data directly from the staging table.
Previous Topic: Java codes/resources were not imported.
Next Topic: Unable to startup Database
Goto Forum:
  


Current Time: Mon Jul 01 02:05:38 CDT 2024