-
Hi.
I have a question about locks.
How can I prevent updates, if another users has a readonly cursor on the row ?
Example
I have two transactions which holds a cursor (read) on one row.
How can I prevent that a third transaction updates this row ?
Thanks in advance
Olaf Oelsner
-
The one who wants to lock his rows must open a cursor with FOR UPDATE option, eg
SELECT ..... FROM .... WHERE ... FOR UPDATE;
This will lock all rows that meet the WHERE conditions.
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
-
Start the 3rd transaction wih SET TRANSACTION READ ONLY;
Thus it will not be able to update the rows.
-
Thanks for your answers.
The first and second transaction do only read operations.
The third transaction should to check if the rows are in use by another transaction, before it tries to update.
In other words:
How can the a transaction check whether rows are currently red by another transactions.
-
Originally posted by OOelsner
In other words:
How can the a transaction check whether rows are currently red by another transactions.
No way to find this that I'm aware of, unless the rows are locked by the reading transaction.
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
-
No way to find this that I'm aware of, unless the rows are locked by the reading transaction.
I also think so. And moreover, if Jurij doesn't know a way, few are the people that might know!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|