PL_SQL 的 循环语句FOR 循环测试
2008-08-20 22:12
531 查看
SQL> create table cities as
2 select username city
3 from all_users
4 where rownum<=37;
Table created.
SQL> alter table cities add constraint cities_pk primary key (city);
Table altered.
SQL> create table with_ri (x char(80),city references cities);
Table created.
SQL> create table without_ri (x char(80),city varchar2(30));
Table created.
1 declare
2 type array is table of varchar2(30) index by binary_integer;
3 l_data array;
4 begin
5 select * bulk collect into l_data from cities;
6 for i in 1..1000
7 loop
8 for j in 1 .. l_data.count
9 loop
10 insert into with_ri
11 values ('x',l_data(j));
12 insert into without_ri
13 values ('x',l_data(j));
14 end loop;
15 end loop;
16* end;
SQL> /
PL/SQL procedure successfully completed.
2 select username city
3 from all_users
4 where rownum<=37;
Table created.
SQL> alter table cities add constraint cities_pk primary key (city);
Table altered.
SQL> create table with_ri (x char(80),city references cities);
Table created.
SQL> create table without_ri (x char(80),city varchar2(30));
Table created.
1 declare
2 type array is table of varchar2(30) index by binary_integer;
3 l_data array;
4 begin
5 select * bulk collect into l_data from cities;
6 for i in 1..1000
7 loop
8 for j in 1 .. l_data.count
9 loop
10 insert into with_ri
11 values ('x',l_data(j));
12 insert into without_ri
13 values ('x',l_data(j));
14 end loop;
15 end loop;
16* end;
SQL> /
PL/SQL procedure successfully completed.
相关文章推荐
- PL/SQL语句学习之使用while、loop和for三种循环打印数字的1-10
- pl/sql中的控制语句应用: 循环语句 loop和for
- Oracle PL/SQL之LOOP循环控制语句
- Oracle PL/SQL之LOOP循环控制语句
- Oracle PL/SQL 找出100以内是3和5的倍数的数 循环语句
- [oracle]pl/sql --循环语句demo
- Oracle:PL/SQL--流程控制(三)——循环结构:loop、while-loop、for-loop
- PL/SQL学习(二)条件和循环语句
- Oracle PL/SQL之LOOP循环控制语句
- [oracle]pl/sql --循环语句demo
- oracle pl sql for循环游标
- Oracle PL/SQL之LOOP循环控制语句
- Oracle PL/SQL之LOOP循环控制语句
- PL/SQL 流程控制语句-条件结构,循环结构
- T_SQL用循环语句向表中插入测试数据
- bash之运算、测试、if语句及for循环语句
- 如何在游标for循环中使用动态SQL语句?
- Oracle PL/SQL之LOOP循环控制语句
- pl/sql 中for和while循环([PL/SQL] 用For Loop 替代Cursor)
- PL/SQL学习笔记之循环语句