sqlldr [message #146428] |
Thu, 10 November 2005 06:43 |
AlinaC
Messages: 45 Registered: November 2005 Location: India
|
Member |
|
|
Hi,
I'm trying to insert data using sqlloader utility of oracle, with the follwing ctl & datafile and want to load a blank field as null,but unable to do so. Data is being inserted into table but blank field is not inserted as null. Can anyone help me? Where should I modify my ctl file.
sample ctl file
load data
INFILE 'student'
BADFILE 'student.bad'
DISCARDFILE 'student.dis'
into table student
fields terminated by ','
TRAILING NULLCOLS
("ROLL" CHAR NULLIF "ROLL" = BLANKS,
"PHONE" CHAR NULLIF "PHONE"=BLANKS)
sample datafile
A001,743234
A002,
A003,567890
,646476
Table
Name Null? Type
-----------------------------------
--------------
ROLL CHAR(5)
PHONE
VARCHAR2(10)
Sample Inserted data
ROLL PHONE
----- ---------
A001 743234
A002
A003 567890
646476
But I want to insert data as follows-
ROLL PHONE
----- ---------
A001 743234
A002 null
A003 567890
null 646476
Regards,
Alina
alina_chatterjee@yahoo.com
|
|
|
|
|
Re: sqlldr [message #146711 is a reply to message #146428] |
Sat, 12 November 2005 22:12 |
|
Barbara Boehmer
Messages: 9101 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Your original control file works fine. The difference is only in how the data is displayed, depending on your set commands, as shown below.
scott@ORA92> SELECT * FROM student
2 /
ROLL PHONE
----- ----------
A001 743234
A002
A003 567890
646476
scott@ORA92> SET NULL NULL
scott@ORA92> SELECT * FROM student
2 /
ROLL PHONE
----- ----------
A001 743234
A002 NULL
A003 567890
NULL 646476
scott@ORA92>
|
|
|