PostgreSQL 怎样跳出内层循环?

danier_sky 2010-06-03 11:13:59
for h in 0..24
loop
for m in 0..59
loop
if m > 51 then
-- 怎样跳出内层循环?
else
--.....
end if;
end loop;
end loop;
...全文
1288 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
ACMAIN_CHM 2010-06-03
  • 打赏
  • 举报
回复
其实如果参考一下手册,其中有很多例子如下。

[Quote]38.6.3.1. LOOP
[ <<label>> ]
LOOP
statements
END LOOP [ label ];
LOOP defines an unconditional loop that is repeated indefinitely until terminated by an EXIT or RETURN statement. The optional label can be used by EXIT and CONTINUE statements within nested loops to specify which loop those statements refer to.

38.6.3.2. EXIT
EXIT [ label ] [ WHEN boolean-expression ];
[/Quote]

LOOP
-- some computations
IF count > 0 THEN
EXIT; -- exit loop
END IF;
END LOOP;


56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧