线程一、
declare
v_test_acc test_acc%rowtype;
begin
--for update 会当前锁行,另外一个进程访问时处于等待状态(阻塞)
--select t.* into v_test_acc from test_acc t where t.code1 = '1010' for update;
--for update nowait 会当前锁行,另外一个进程访问时会直接返回当前结果
select t.* into v_test_acc from test_acc t where t.code1 = '1010' for update nowait;
end;
线程二、
declare
v_test_acc test_acc%rowtype;
begin
--for update 等待操作任务提交commit(阻塞)
--for update nowait 直接返回当前结果
select t.* into v_test_acc from test_acc t where t.code1 = '1010';
dbms_output.put_line(v_test_acc.num1);
end;