I want to know where to use the Cursor with hold while declaring a cursor. I know that if we do not use a cursor with hold for then while we issue a commit statement then the cursor is closed and reopened which is a overhead. To avoid this cursor with hold for is used. But does this mean that then every cursor declared should have a cursor with hold for option or is there any specific scenario where I should use it. I have gone through the manuals and forum but can't decide where to use it and where not to use it. Can you provide some example or scenario where I should be using it.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Hello and welcome to the forum,
It sounds as though you have a solution in search of a requirement. . .
Suggest you invest your time on this when the requirement has presented itself.
Also, if COMMITs are issued only at the end of some logical unit of work, they will not be issued very often and thus will not cause much overhead. . . Due to faster CPUs and dasd, many organizations no longer use COMMITs within a process. . .
One of the scenerio may be like....you have cursor within a cursor...and you want to commit inner cursor for every row fetch of outer cursor..in that case... you may need to declare the outer cursor with hold option so that it doesnot closes when commit is issued for inner cursor.