Little Challenge for Leaders [message #84225] |
Tue, 17 February 2004 08:41 |
Imran Ahmad
Messages: 22 Registered: March 2002
|
Junior Member |
|
|
Hello I have question for all gurus here, b/c this is an important question for all. I want to share values between sessions without commiting the record. Like in java one can share values through static variable.
I define the scnerio, If 2 users r connected A & B and there is a form through one can view employees detail with respect to their department. If A queries the record of department 10 (only queries), i want to restrict B for selecting department 10. I create a canvas in which i ask department no.
I have in mind that if anyway possible i place A and department 10 in variable and that variable is visible to all sessions then i just need to check those variables but thats not work. Plz tell how can i do this task.
Imran
|
|
|
Re: Little Challenge for Leaders [message #84235 is a reply to message #84225] |
Wed, 18 February 2004 09:53 |
magnetic
Messages: 324 Registered: January 2003
|
Senior Member |
|
|
don't use variables
lock the record before the select statement :)
and release it after you are done.
the user B should get message like "record is reserverd.. bla bla" when he tries to select that record...but who cares...
find the syntax for locking a record..
another solution is:
create a table "mylockedrecords" with columns that are the primary key of a table.
each time one tries to select a record, this table should be checked if there is a locked record.
if so , you should "minus select" this record from the normal select.
solution 3:
depending on your oracle database version,
i guess you can give grants on record level :)
|
|
|
Re: Little Challenge for Leaders [message #84244 is a reply to message #84235] |
Wed, 18 February 2004 22:57 |
Martin Chadderton
Messages: 35 Registered: May 2003
|
Member |
|
|
Locking the row won't prevent the application from selecting it directly (locks will only kick in when an attempt to modify the row is made, or a command such as SELECT .. FOR UPDATE [[NOWAIT]] and even then, the app will either error or wait for the lock to be released (depending if you specified NOWAIT or not).
Not exactly a good scalable solution.
However, the lock mechanism is a potential solution, if used in conjuction with a 9i feature, i.e.
SQL> SELECT * FROM TEMP FOR UPDATE SKIP LOCKED;
Will only return non-locked records (and then subsequently lock them), but we're not told what version of the database they're running.
|
|
|
Re: Little Challenge for Leaders [message #84261 is a reply to message #84244] |
Sun, 22 February 2004 05:05 |
Imran
Messages: 56 Registered: November 2001
|
Member |
|
|
my oracle version is Oracle 8i and the problem with locks is; how i release the lock b/c lock is only release with the help of ROLLBACK or COMMIT. And if i use commit then its not good until user wants to commit and if i use ROLLBACK then it clears the form rather then releasing the lock(only).
Your response is required.
Thankx
Imran
|
|
|