‎2014 Aug 11 7:14 PM
HI
In one of the cases I came across this syntax
select * from ....
commit work.
I know commit work closes the current LUW and opens new one, what is the correct benefit of writing commit work after select statement is fired on any table?
Thanks
‎2014 Aug 11 7:23 PM
‎2014 Aug 11 7:50 PM
Select statement only read data and doesn't make change in database to use commit work.
‎2014 Aug 11 7:49 PM
Hello Sam
If there is no logic between these two statements (SELECT and COMMIT WORK) then I see no benefit from this logic.
regards
‎2014 Aug 11 8:16 PM
Hi Sam,
Are there more statements written in the program above Select statement?
If yes, then it might be that some database update is happening in program and commit is used for them.
However, there is no effect if commit is put right after select statement.
You can move on top of select (if more code is present before select statement)or remove the commit statement.
Thanks
Amit
‎2014 Aug 11 8:49 PM
Thanks all really speaking there are no other statements between just select and commit, strange , that is why I put this query.
‎2014 Aug 11 9:06 PM
How developed this code? Can you contact the person who did this? Otherwise you can remove it I think.
Thanks
Amit
‎2014 Aug 12 8:58 AM
Hi
Sometimes COMMIT is required for example to save data to SPOOL.
I would not remove the line if you do not know why it is there. However, in your own coding, do not use that kind of sequence. COMMIT is not needed after SELECT.
regards
‎2014 Oct 08 2:29 PM
Commit work is used to reset the time limit counter, e.g after a long time run select statement.