one of my interview question this below..if we any one explain? i did not understand this question..

Posted by Rajesh123 under Oracle on 8/19/2015 | Points: 10 | Views : 236 | Status : [Member] | Replies : 1
There is a temp table called TEMP. There is a target table called TARGET.
The text file called file1.txt is loaded into TEMP. From TEMP while loading into TARGET table, based on the PK constraint on TARGET,
the load happens from TEMP to TARGET. The load into TARGET fails due
to “Unique constraint violation” Error. How do we figure out –

a. The records that caused unique constraint violation error.

b. How to delete the records causing this error.

c. How to ensure that the right number of records gets loaded into TARGET table.


Posted by: Bandi on: 8/20/2015 [Member] [MVP] Platinum | Points: 25

use try...catch method to catch the unique constraint violation and do the logic to log that erred record into some file/table. then continue with next record for loading from TEMP to TARGET table

Look into LOAD/EXPORT/IMPORT utilities in Oracle which provides you solution for this kind of activities....
In the command itself we can specify the source and target tables. Also, we can ignore the exception caused records and move those into some log files...

Mark This Response as Answer

Rajesh123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response