Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Check to see if a record is locked by another User ?

RoxyrollersJan 27 2011 — edited Jan 28 2011
Hello folks,
I am using Oracle Forms 10g and I am trying to see if a particular record has been locked. If it's been locked (because a User made changes to the record), then I will issue a Message and do a raise form trigger failure. I have created a procedure for it.

So, I have the Student details open in Form 1 for the Student ID. I don't make any changes and then I go ahead and open another session (Same Form and query and same Student ID). Here, even though I made no changes to the record in Form 1, I am getting the exception error in Form 2.

Any help would be great. Meanwhile, here is the piece of code.

For some bizzare reason, it's not allowing me to add the select statement in the code

Its bascially a select statment with a FOR UPDATE NOWAIT
PROCEDURE check_record_locked IS
  v_temp          varchar2(1);
  record_in_use   exception;
  pragma          exception_init(record_in_use, -00054);

  cursor c_get_rows_locked is
    select 'X'

begin
  if :GRAD_STU_BK.student_id IS NOT NULL then
    open  c_get_rows_locked ;
    fetch c_get_rows_locked into v_temp;
message('Temp = '||v_temp);
    close c_get_rows_locked;
  end if;
 
exception
    when record_in_use then
       MESSAGE('You have unsaved changes ...');
       raise form_trigger_failure;
end;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2011
Added on Jan 27 2011
9 comments
4,778 views