View previous topic :: View next topic
|
Author |
Message |
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
hi,
i want to delete 5 rows from a table ... after successfull execution of 3 ..4th row was not found and the delete stmt failed ....will the first 3 rows be restored ...ie will a roll back happen?
thanks |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
HI there,
When your program abends, (if it truly abends), the system will automatically 'rollback' (backout) all of your updates to the last 'commit', or in the absence of a 'commit', to the beginning of your program.
So if u have commit stmt after every delete or befor the abends occurs then first 3 rows wont be there if it abends while deleting 4th row otherwise first 3 row will be restored |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
hI'
ashimer wrote: |
i want to delete 5 rows from a table ... after successfull execution of 3 ..4th row was not found and the delete stmt failed ....will the first 3 rows be restored ...ie will a roll back happen? |
It depends....I assume this was a program? Was his a delete under a cursor or separate deletes? What did the program do when the 4th row was not found? Did it abend or continue? More information is helpful....
Bill |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
the delete was not using cursor ..it was normal delete stmt .... the program deleted the 3 rows ....then on sqlcode 100 at 4th the program abended ..but still the first 3 rows were not restored ...... does delete stmt does a commit after successfull execution ? ... |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
Do u have any explicit commit befor the job abends? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
ashimer wrote: |
the delete was not using cursor ..it was normal delete stmt .... the program deleted the 3 rows ....then on sqlcode 100 at 4th the program abended ..but still the first 3 rows were not restored ...... does delete stmt does a commit after successfull execution ? ... |
Within the program, commits are not automatic, they must be specifically requested. I'd assume that the entire LUW was backed out. Can the program handle the sqlcode 100 and just continue without abending? |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
there is no explicit commit ..once sqlcode 100 is found it calls another subroutine to abend ... |
|
Back to top |
|
|
|