当前位置:Gxlcms >
数据库问题 >
ORACLE fetch bulk collect into limit
ORACLE fetch bulk collect into limit
时间:2021-07-01 10:21:17
帮助过:1人阅读
TYPE rr IS REF
CURSOR;
TYPE r_emp IS RECORD(
empno NUMBER(
4),
ename VARCHAR2(
10),
job VARCHAR2(
9),
mgr NUMBER(
4),
hiredate DATE,
sal NUMBER(
7,
2),
comm NUMBER(
7,
2),
deptno NUMBER(
2));
TYPE t_e IS TABLE OF r_emp;
e t_e;
ee t_e:= t_e();
r rr;
BEGIN
OPEN r
FOR
SELECT * FROM apps.emp;
LOOP
EXIT WHEN r
%notfound;
--写在FETCH后面会掉数据
FETCH r
BULK COLLECT
INTO e LIMIT
5;
ee := ee multiset
union e;
END LOOP;
for i
in 1..ee.
count loop
dbms_output.put_line(ee(i).empno);
end loop;
END;
ORACLE fetch bulk collect into limit
标签: