PL_SQL 的 循环语句FOR 循环测试

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值