GOTO
更新时间 2025-02-14 10:22:08
最近更新时间: 2025-02-14 10:22:08
本页介绍天翼云TeleDB数据库存储过程开发的GOTO语句。
teledb=# 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
teledb=# call p_goto(5);
NOTICE: i=1
NOTICE: i=2
NOTICE: goto end
CALL
teledb=#
go 用于跳转到某个标签下。