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
- deselect the master record;
- exit form;
- querying record;
I try to put rollback
as marked in the above but failed, it cleared the master block.
Please help