GOTO

最近更新时间: 2026-03-13 09:03: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;