Home » RDBMS Server » Server Utilities » possible to use 'WHEN' in SQL Loader Control file to check for existing data in end table?
possible to use 'WHEN' in SQL Loader Control file to check for existing data in end table? [message #257062] Tue, 07 August 2007 08:53 Go to next message
mariag
Messages: 1
Registered: August 2007
Location: UK
Junior Member
Hello

I was wondering if its possible to check for existing data in order to avoid duplicating it in the end table when using SQL Loader?

Here is my SQL Loader file:

LOAD DATA
INFILE 'iptvchannel.csv'
BADFILE 'iptvchannel.bad'
APPEND
INTO TABLE IPTVCHANNEL
fields terminated by X"09"
( ID,
EXTERNALNO,
TITLE,
AVAILABILITY "to_number(:availability)",
CALLLETTERS,
NAME,
lastupdated sysdate)

I wanted to use 'WHEN' to check to for existing data (identified by ID) so the data would not be entered again and thus making duplicates in the end table?

Is it possible or do I have to do it another way?

Thanks!

Re: possible to use 'WHEN' in SQL Loader Control file to check for existing data in end table? [message #257075 is a reply to message #257062] Tue, 07 August 2007 09:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68664
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't in the control file but why not just using a unique key on the table then the duplicates will be rejected?

Regards
Michel


Re: possible to use 'WHEN' in SQL Loader Control file to check for existing data in end table? [message #257076 is a reply to message #257062] Tue, 07 August 2007 09:20 Go to previous message
cbruhn2
Messages: 41
Registered: January 2007
Member
Hi Mariag,

as far as I know the when clause will only check on the data you provide in the load, not on data in the table.
If duplicates are note allowed you could consider having a unique index on one or more of the columns, so data wouldn't be loaded, if the record already existed.
Otherwise you could load data in another table and then use merge to load data into the real table

best regards
Carl Bruhn
Previous Topic: export & import scripts
Next Topic: exporting using exp
Goto Forum:
  


Current Time: Sat Jun 22 22:27:55 CDT 2024