Hi
I have a scenario where i need to commit the database insertion only if certain condition meets.
Eg: i am reading a file line by line and started inserting the same into a table and if the line containe 'ABC' then commit the records inserted sofar and start new insertion.
Any help would be great.
How to do conditional commit?
Moderators: chulett, rschirm, roy
I hope i should be more clear about my requirement.
I am reading the lines from seq. file and group of lines forms a record in table. If line contains 'ABC' then that is starting of new record, which means we have to commit the group of lines we have inserted so for in table.
Eg: i have 25 lines in my file and first line has ABC so started forming the record, read first line of length100 charcters(fixed),read second line (100chars) append to first line(total 200) in stage and the lenght of column in table is 200 so insert the line with sequence number as 1 and don't commit yet. start reading the 3rd line (100 charas) and 4th line has 'ABC" which means new record.
Now add my 3rd line with seq number 2 to table as second row and commit the transcation.
These sequence numbers 1 and 2 forms record. So either insert both or reject both. So my condition is up on existance of 'ABC' in the line issue commit instruction to DB.
I am reading the lines from seq. file and group of lines forms a record in table. If line contains 'ABC' then that is starting of new record, which means we have to commit the group of lines we have inserted so for in table.
Eg: i have 25 lines in my file and first line has ABC so started forming the record, read first line of length100 charcters(fixed),read second line (100chars) append to first line(total 200) in stage and the lenght of column in table is 200 so insert the line with sequence number as 1 and don't commit yet. start reading the 3rd line (100 charas) and 4th line has 'ABC" which means new record.
Now add my 3rd line with seq number 2 to table as second row and commit the transcation.
These sequence numbers 1 and 2 forms record. So either insert both or reject both. So my condition is up on existance of 'ABC' in the line issue commit instruction to DB.
Hari