Home » RDBMS Server » Server Utilities » Loading data from flat file conditionally??
Loading data from flat file conditionally?? [message #71580] Mon, 25 November 2002 08:55 Go to next message
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 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
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.
Re: Loading data from flat file conditionally?? [message #71613 is a reply to message #71580] Tue, 03 December 2002 07:48 Go to previous message
sai sreenivas jeedigunta
Messages: 370
Registered: November 2001
Senior Member
Hi ,
you can do this in many ways..one is by using the WHEN clause in SQLLDR
or else, try using the UTL_FILE package which is used for performing the Flat File operations..

sai
Previous Topic: Urgent! transfer excel table into Oracle
Next Topic: send me ORACLE Certified Professional Exam 1Z0-001
Goto Forum:
  


Current Time: Mon May 13 16:26:54 CDT 2024