How to update existing table using SQL Loader [message #525179] |
Fri, 30 September 2011 00:27  |
 |
shiveclat
Messages: 19 Registered: August 2011 Location: pune
|
Junior Member |
|
|
Hi All,
I am using a shell script to load unix content to a database.
I have captured the unix data to a csv file and I am using a sql loader to inser that csv data to database. following is my ctl file contents.
[b]load data
infile data.csv
into table AVS_LOGS
fields terminated by ','
(
RUNDATETIME,
SERVER,
DIRECTORY,
FILENAME,
LASTUPDATETIMESTAMP
) [/b]
and I am using sql loader command in unix that is
[b]sqlldr $CLOGIN control=control.ctl log=test.log[/b]
But this is working only if the table is empty.
Now I am looking for something where I do not need to delete the data from table each time. it should update the table.
can some please help me into this.
Thanks
|
|
|
Re: How to update existing table using SQL Loader [message #525181 is a reply to message #525179] |
Fri, 30 September 2011 00:40   |
 |
Barbara Boehmer
Messages: 9104 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
If you mean append, then:
load data
APPEND
infile data.csv
into table AVS_LOGS
fields terminated by ','
(
RUNDATETIME,
SERVER,
DIRECTORY,
FILENAME,
LASTUPDATETIMESTAMP
)
If you actually mean update, then load into a staging table and use merge.
[Updated on: Fri, 30 September 2011 00:40] Report message to a moderator
|
|
|
|
|
|
|