Skip column while loading data using SQL Loader [message #157734] |
Sun, 05 February 2006 00:12 |
AlinaC
Messages: 45 Registered: November 2005 Location: India
|
Member |
|
|
Data
Sl# Emp_no Name Address
001 01 Tom 1/B-XYZ street
002 02 Jon 1/C-XYZ Street
Employee Datafile
001, 01, Tom, 1/B-XYZ street
002,02,Jon, 1/C-XYZ Street
Above is a sample data file. Now I would like to import the data into an Oracle table called employee using Oracle 9i SQL Loader utility. But the table has only 3 fields (Emp_no,Name & Address), so I would like to skip Sl# while loading data. I do not want to manually modify data file. How should I write .ctl file.
Sample .ctl file.
load data
INFILE 'data\Employee'
BADFILE 'Employee.bad'
DISCARDFILE 'Employee.dis'
into table Employee
fields terminated by ','
TRAILING NULLCOLS
(Emp_no NULLIF Emp_no = BLANKS,
Name NULLIF Name = BLANKS,
Address NULLIF Address = BLANKS
)
Regards,
Alina
|
|
|
|
|
Re: Skip column while loading data using SQL Loader [message #554862 is a reply to message #158159] |
Fri, 18 May 2012 01:27 |
|
Hi Alina,
its simple, you no need to insert manually NULL values for rest of the columns, Oracle by default it will insert null values. let's try to insert ( write a script- control file) only for available field from data files.
Thanks and Regards,
Vetrivel Karuppan (Oracle-Dharmapuri)
|
|
|
|