Home » RDBMS Server » Server Utilities » SQL*LOADER Question (10g)
SQL*LOADER Question [message #380326] Sat, 10 January 2009 21:59 Go to next message
Bangla
Messages: 49
Registered: August 2008
Member
I have a csv file like below.

ID NAME ADDRESS PHONE1 PHONE2
----- ------- -------- --------- ----------
01, Ona Hasan, Bangladesh, 001, 002
02, B Hasan, Bangladesh, 001, 002
03, C Hasan, Bangladesh, 001, 002
04, D Hasan, Bangladesh, 001, 002


Now without changing anything in my CSV file I only want to load first 3 fields into a table from the csv file. Can I achieve that in Sql*loader?



Another question is while loading data from CSV file can I pass any default value? For example I want to pass an extra CITY column default value DHAKA while loading data into the table.
Re: SQL*LOADER Question [message #380328 is a reply to message #380326] Sat, 10 January 2009 22:36 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
The following should work:

OPTIONS (skip=2)
load data
infile '/tmp/data.dat'
append
into table table1
fields terminated by ","
(id,
 name,
 address,
 phone1 filler,
 phone2 filler,
 city constant 'DHAKA')

Re: SQL*LOADER Question [message #380343 is a reply to message #380326] Sun, 11 January 2009 01:55 Go to previous message
Bangla
Messages: 49
Registered: August 2008
Member
A big thanks. I was too lazy to find the constant option.
Previous Topic: Migrating Oracle 10g from Windows XP to Linux
Next Topic: Loading data from CSV file specially
Goto Forum:
  


Current Time: Sun Apr 28 06:15:45 CDT 2024