PLSQL 循环示例

<pre name="code" class="sql"><pre name="code" class="sql">SQL> create or replace procedure test_1 is
begin
  for i in 1 .. 10 loop
    DBMS_OUTPUT.PUT_LINE(i);
  end loop;
end;  2    3    4    5    6  
  7  /

过程已创建。

SQL> exec test_1
1
2
3
4
5
6
7
8
9
10

PL/SQL 过程已成功完成。
----------
create or replace procedure bfw_do_select is
begin
  for x in (select * from bfw_test2) loop
  DBMS_OUTPUT.PUT_LINE(x.id);
  end loop;
end;






原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3797838.html