17,140
社区成员




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;
/