17,078
社区成员
发帖
与我相关
我的任务
分享
declare
lastid decimal;
begin
SELECT step_id into lastid FROM table where step_id=1 for update;
EXCEPTION WHEN No_Data_Found THEN
NULL;
commit;
end;
declare lastid decimal;
row number:=0;
begin
select count(1) into row from mytable where step_id=1;
if row<>0 then
SELECT step_id into lastid FROM mytable where step_id=1 for update;
commit;
end if;
end;
/