Click to See Complete Forum and Search --> : sql loader control file question


welchdor
09-02-2004, 08:07 PM
I have been looking through the SQL*Loader documentation this afternoon, but haven't found what I need.
In my control file, I am loading a char. field that if it is blank or null, I want to load it as "0".

I don't see where NULLIF or DEFAULTIF help me with this. Can some one tell me how to do it?

Thanks in advance.

pando
09-03-2004, 03:31 AM
use decode such as

decode(:filed_a, null, '0', :field_a)

however defaultif does what you want as well, you may need to use preserve blanks, defaultif sets non-numeric to NULL and numeric to 0 if the condition is satisfied

http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1007544

welchdor
09-03-2004, 07:22 PM
I would like to be able to use the decode function, but this is what I got when I tried it:

SQL*Loader: Release 8.0.5.0.0 - Production on Fri Sep 3 15:8:54 2004

(c) Copyright 1998 Oracle Corporation. All rights reserved.

SQL*Loader-350: Syntax error at line 7.
Expecting "," or ")", found "(".
decode(:METER_NBR, NULL, '0', :METER_NBR),
^

C:\orant\BIN>