oracle11g 闪 没反应,传说中ORACLE11G有BREAK语句了,为什么我无效?

应该是只有continue

http://beyondrelational.com/modu ... cle-11gs-plsql.aspx

CONTINUE-WHEN statement

Syntax

view sourceprint?1.Continue-When(Condition)

Once the condition in the When clause is evaluated and if found true, the current iteration of the loop completes and control passes to the next iteration.

Let us see into action

view sourceprint?01.SQL> BEGIN

02.

2     FOR i IN 1 .. 10 LOOP

03.

3        CONTINUE WHEN MOD(i,2) = 0;

04.

4       DBMS_OUTPUT.PUT_LINE('Numbers := ' || TO_CHAR(i));

05.

5     END LOOP;

06.

6  END;

07.

7  /

08.Numbers := 1

09.Numbers := 3

10.Numbers := 5

11.Numbers := 7

12.Numbers := 9

13.PL/SQL procedure successfully completed.

We can figure out that the even numbers trigger the control to the beginning of the loop.

The CONTINUE-WHEN statement can also be used with LOOP LABELS as shown under

view sourceprint?01.SQL> BEGIN

02.

2     <>

03.

3     FOR i IN 1 .. 10 LOOP

04.

4        CONTINUE outer_loop WHEN MOD(i,2) = 0;

05.

5        DBMS_OUTPUT.PUT_LINE('Numbers := ' || TO_CHAR(i));

06.

6     END LOOP;

07.

7  END;

08.

8  /

09.Numbers := 1

10.Numbers := 3

11.Numbers := 5

12.Numbers := 7

13.Numbers := 9

14.PL/SQL procedure successfully completed.

We have the Continue statement in Sql Server too about which u can read from

SQL SERVER – Simple Example of WHILE Loop with BREAK and CONTINUE

SQL SERVER – Simple Example of WHILE Loop With CONTINUE and BREAK Keywords

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值