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 -> sqlldr and defaultif

sqlldr and defaultif

From: will Chakraborty <uchakraborty_at_manh.com>
Date: 25 Apr 2003 09:56:09 -0700
Message-ID: <e9fbcf8a.0304250856.62eb97a4@posting.google.com>


According to Ooracle documentation, the defaultif keyword can be used in the   sqlldr control file so a 0 ( zero) is inserted for the numeric column if   the input datafield is null.

Example

 create table t(col1 number, col2 number(10), col3 number)

controlfile


LOAD DATA
INFILE "t.dat"
append INTO TABLE t
FIELDS TERMINATED BY '|'
trailing nullcols
(
col1,
col2 defaultif col2=blanks ,
col3 )

datafile


1||2
2|15|3

sqlplus> truncate table t ;

sqlldr userid=xx/yy control=t.ctl

I expect 0 and 15 should be inserted for col2. However, the values are always null and 15.

If anyone has an example that works for this case, can you please share that. I am using Oracle 9.2.0.2 on AIX 5.1.

Regards

Will Received on Fri Apr 25 2003 - 11:56:09 CDT

Original text of this message

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