declare
cursor cursor_test
is select * from bss_epon_interface where rownum<10
--where area_id like '%01'
;
type cursor_test_tab is table of bss_epon_interface%rowtype;
cursor_test_id cursor_test_tab;
begin
open cursor_test;
loop
fetch cursor_test bulk collect into cursor_test_id limit 1 ;
for i in 1..cursor_test_id.count loop
dbms_output.put_line(I||'AREA_ID'||cursor_test_id(I).orderid||
'AREA_FATHERID'||CURSOR_TEST_ID(i).areaid);
exit when cursor_test%notfound;
end loop ;
exit when cursor_test%notfound;
end loop ;
close cursor_test;
end; 游标 循环 跳出
解决方案 »
- 关于oracle数据库临时表空间满了的问题
- sqlserver2000访问oracle9i的问题,请高手指教
- 求一SQL语句
- insert into 如何一次插入多条记录
- 求助:Enterprise Manager 无法继续。最可能的原因是无法检索数据库会话信息, 或 EM 无法处理用户调用的书签。 按“确定”即可继续。
- 找不到table
- 怎么在sql语句中实现类似sqlserver中两个子段相加(两个都是字符串字段)
- 请问ORACLE的预定义用户名和密码是manager和system吗
- 有一段SQL语句,在PLSQL上可以执行,为什么VS上出现了ORA-00923: 未找到要求的 FROM 关键字
- sql server用户学oracle应该怎么入手
- 关于组合索引
- 急求oracl触发器的写法!!!
cursor cursor_test
is select * from bss_epon_interface where rownum<10
--where area_id like '%01'
;
type cursor_test_tab is table of bss_epon_interface%rowtype;
cursor_test_id cursor_test_tab;
begin
open cursor_test;
loop
fetch cursor_test bulk collect into cursor_test_id limit 2 ;
exit when cursor_test%notfound;---当跳出游标放这里的时候,没循环完就跳出了呢
for i in 1..cursor_test_id.count loop
dbms_output.put_line(I||'AREA_ID'||cursor_test_id(I).orderid||
'AREA_FATHERID'||CURSOR_TEST_ID(i).areaid);
end loop ;
end loop ;
close cursor_test;
end;
declare
cursor cursor_test is
select *
from bss_epon_interface
where rownum < 10
--where area_id like '%01'
;
type cursor_test_tab is table of bss_epon_interface%rowtype;
cursor_test_id cursor_test_tab;
begin
open cursor_test;
loop
fetch cursor_test bulk collect
into cursor_test_id limit 1; --cursor_test每次仅抓取一条记录
for i in 1 .. cursor_test_id.count loop
dbms_output.put_line(I || 'AREA_ID' || cursor_test_id(I).orderid ||
'AREA_FATHERID' || CURSOR_TEST_ID(i).areaid);
exit when cursor_test%notfound; -- 读完一条记录就退出,重新进入循环抓取一条记录
end loop;
exit when cursor_test%notfound; --读完所有游标数据退出整个循环
end loop;
close cursor_test;
end;