Home » RDBMS Server » Server Utilities » SQL Loader-Need to update or insert
SQL Loader-Need to update or insert [message #294926] Sun, 20 January 2008 22:17 Go to next message
vino_83
Messages: 2
Registered: January 2008
Junior Member
I am loading the table using sql loader as below:

LOAD DATA CHARACTERSET WE8ISO8859P1
APPEND INTO TABLE PRDC_CHR
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
BRN_CD,
CHR_NM,
CHR_VL_CD,
CHR_VL_DSC,
MAP_DT "to_date(sysdate, 'YYYYMMD')"
)

Instead of append here, I want to implement the merge functionality here, i.e., update if an existing record else insert the new record.

For eg.
Consider ,the table has got a record with BRN_CD as 20 with values for other fields. If the input file which is going to be appended also has a record with BRN_CD as 20 with some other values for other fields, I should update that particular record in the table with the new values for tht record from the file. If it's a completely new record, it should do an insert.

Thanks
vino
Re: SQL Loader-Need to update or insert [message #294937 is a reply to message #294926] Sun, 20 January 2008 23:23 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
SQL*Loader does not do updates or merges. You need to load it into a staging table, then use merge to insert and/or update.
Re: SQL Loader-Need to update or insert [message #294950 is a reply to message #294926] Mon, 21 January 2008 00:24 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use external table instead of SQL*Loader and you can then use MERGE statement.

Regards
Michel
Re: SQL Loader-Need to update or insert [message #295242 is a reply to message #294937] Mon, 21 January 2008 19:56 Go to previous message
vino_83
Messages: 2
Registered: January 2008
Junior Member
ok..Thanks..
Previous Topic: sqlldr
Next Topic: ORA-27369: job of type EXECUTABLE failed with exit code: Not owner
Goto Forum:
  


Current Time: Fri Dec 09 13:25:43 CST 2016

Total time taken to generate the page: 0.12440 seconds