Dear All,
I need some input for the following from your side..please.
I have flat file and i need to read one by one records from this file and have to insert it into DB2 table. There is a primary key for this table.
Here what are the scenario i have to handle to avoid duplicate insertion error and others ...
here my doubt is ..how to handle duplicate insertion error and how to have unique key ..
Joined: 06 Dec 2004 Posts: 200 Location: Keane India Ltd., Hyderabad
Hi Vijay,
You go through the following steps...
1. Read File
2. Move File Variables into Host Variables
3. Execute Insert statement
4. IF SQLCODE=-803 THEN
DO ROLLBACK;
ELSE
IF SQLCODE = 0 THEN
DO COMMIT;
But It will take a long time. If it is a one time program then its ok. Other wise follow the steps suggested by Anubudan.