Loading data from flat file conditionally?? [message #71580] |
Mon, 25 November 2002 08:55 |
raman
Messages: 66 Registered: February 2000
|
Member |
|
|
Hi
I happened to be in such a situation, have to load data from a flat file into multiple tables(Master & Child)....but if the row ID is already existing then it should get updated else the row should get inserted! Is it possible to do with SQL*LOADER?
thankyou,
Raj
|
|
|
Re: Loading data from flat file conditionally?? [message #71581 is a reply to message #71580] |
Mon, 25 November 2002 09:10 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
raj,
u can use something equal to OR, WHEN, IF etc.
conditional loading is supported.
but i beleive, ur case is different.
becuas u cannot UPDATE in sql*loader.
u can insert or replace or append.
the possible workaround is
1. create a primary constraint in the table.
2. load the records
3. but, if the constraint is violated (if the value
for column ID is already there) store them in a
different table (exceptions table).
4. then, update the original table, with the records in expections table.
sounds OK?
pls refer to our other posting , for a detailed example on this.
refer here.
http://orafaq.net/msgboard/serverutil/messages/5178.htm
NOTE:
the above links shows an example of deleteing the bad data( ie, PK records that already exists).
but ur case need to be updated.
|
|
|
|