exitwhen.sql

来自「Oracle 9i PL/SQL程序设计的随书源码」· SQL 代码 · 共 20 行

SQL
20
字号
REM exitwhen.sql
REM Chapter 3, Oracle9i PL/SQL Programming by Scott Urman
REM This block illustrates the EXIT WHEN clause.

DECLARE
  v_Counter BINARY_INTEGER := 1;
BEGIN
  LOOP
    -- Insert a row into temp_table with the current value of the
    -- loop counter.
    INSERT INTO temp_table
      VALUES (v_Counter, 'Loop index');
    v_Counter := v_Counter + 1;
    -- Exit condition - when the loop counter > 50 we will 
    -- break out of the loop.
    EXIT WHEN v_Counter > 50;
  END LOOP;
END;
/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?