|
View previous topic :: View next topic
|
| Author |
Message |
hsk
New User
Joined: 28 Nov 2006 Posts: 69 Location: India
|
|
|
|
I have seen many posts for this topic and have searched a bit but have one question about the 'lock' ...............
I am using cursor with 'WITH HOLD' option, and depending upon a indicator field,have a logic to either update the fetched row or insert a new row in table, this is performed in loop .........
So there are 3 possibilities,
a. fetch the row and no action is taken ......
b. fetch the row and update the row
c. fetch the row and insert a new row
if the isolation level is => Cursor stability =>
Following should be true ...........
1. The rows for which no action is taken should be available to other transaction (or program ...whatever) as cursor moves to next row
These will be locked only when that particular row is fetched.
2. The rows which are updated or the new rows inserted will NOT be available and will be locked until "COMMIT" or end of the job.
If this is true .............. then if i am using cursor WITH HOLD, and there are total 10,000 rows to be processed .....
I have a logic to perform COMMIT after every 1000 rows.
After the first 1000 rows will the locks on these 1000 rows be released or the "WITH HOLD" option will hold the locks until the end of Job ??? |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
suggest you read the manual to understand what 'WITH HOLD' means.
stop guessing. |
|
| Back to top |
|
 |
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
| hsk wrote: |
if i am using cursor WITH HOLD, and there are total 10,000 rows to be processed .....
I have a logic to perform COMMIT after every 1000 rows.
After the first 1000 rows will the locks on these 1000 rows be released or the "WITH HOLD" option will hold the locks until the end of Job ??? |
hsk,
According my knowledge, The locks on 1000 rows will be released because the concept behind WITH HOLD is keep open cursor option even though COMMIT or ROLLBACK operation will be imposed
<internally WITHHOLD position will repositioned to previous read records that is the record which comes after COMMIT operation>
---------------------------------------------------------------------
WITH HOLD option is not related to LOCKS
Regards,
Raghavendra |
|
| Back to top |
|
 |
|
|