GOTO
最近更新时间: 2024-10-17 17:10:00
postgres=# create or replace procedure p_goto(v_maxnum integer) as
$$
declare
maxnum integer;
begin
maxnum := v_maxnum;
for i in 1..maxnum loop
if i=3 then
goto label;
end if;
raise notice 'i=%',i;
end loop;
<<label>>
raise notice 'goto end';
end;
$$
language plpgsql;
CREATE PROCEDURE
postgres=# call p_goto(5);
NOTICE: i=1
NOTICE: i=2
NOTICE: goto end
CALL
postgres=#
go用于跳转到某个标签下。