0

This is my first time using for update nowait in Oracle Forms 12c in order to lock a record.

I have a master-detail Forms blocks, both data block are being shown in tabular layout style. The master block is allowed to update.

When double click a master record after query block, it will go to details block and fire execute_query.

I need to lock the master record manually when double click it.

In data block trigger when-double-click, I put the following:

  declare

      t_dummy varchar2(10);

  begin

    --rollback;

    Select 'y'
      into t_dummy
      from table
     where voucherno=:master.voucherno
     for update nowait;

    go_block('detail');
    execute_query;

  exception
    when others then
      message('Fail to lock record. Other user is locking it.');
      raise form_trigger_failure;

  end;

I have no idea where/how to use rollback. I need to unlock the record when

  1. deselect the master record;
  2. exit form;
  3. querying record;

I try to put rollback as marked in the above but failed, it cleared the master block.

Please help

APC
  • 144,005
  • 19
  • 170
  • 281
Learner
  • 33
  • 1
  • 4
  • Why do you need to lock the master row? What processing do you do with the details block? – APC Nov 28 '18 at 08:17
  • Master table will be updated for any action taken in detail block, therefore, the SA just wants to freeze the master record. – Learner Nov 28 '18 at 08:47
  • You need to be careful with this. What should happen if the user makes changes to the Detail block (which makes changes to the Master block) then navigates to the Master block and deselects the record: do you want to issue a rollback? Or a commit? Or maybe display a dialog box asking the user whether they want to save changes? – APC Nov 28 '18 at 08:56

0 Answers0