GOTO

最近更新时间: 2024-10-17 17:10:00

语法:

GOTO lable

示例:

create tablegoto_test(id int,name varchar);

create orreplace function goto_func(v_maxnum integer) returns void as
declare
maxnuminteger;
begin
maxnum :=v_maxnum;
for i in1..maxnum loop
if i=3 then
goto label;
end if;
insert intogoto_test values (i,'hasai');    
end loop;
<<label>>
updategoto_test set name = 'user1' where id = 2;
end;
/

select goto_func(5);


select *from goto_test;