注册
达梦数据库支持 fetch CUR bulk collect into XX limits N 么 ?
专栏/龙山溪笔谈/ 文章详情 /

达梦数据库支持 fetch CUR bulk collect into XX limits N 么 ?

myth8860 2021/02/05 1902 1 0
摘要 达梦数据库支持 fetch CUR bulk collect into XX limits N 么 ?
create TABLE COURSE ( COURSE_NO NUMBER(38), DESCRIPTION VARCHAR2(50), COST NUMBER(9,2), PREREQUISITE NUMBER(8), CREATED_BY VARCHAR2(30), CREATED_DATE DATE, MODIFIED_BY VARCHAR2(30), MODIFIED_DATE DATE ); INSERT INTO COURSE VALUES(1,'22223',1,1,'20150101',SYSDATE,'20150101',SYSDATE ); INSERT INTO COURSE VALUES(2,'22223',1,1,'20150101',SYSDATE,'20150101',SYSDATE); INSERT INTO COURSE VALUES(3,'22223',1,1,'20150101',SYSDATE,'20150101',SYSDATE); INSERT INTO COURSE VALUES(4,'22223',1,1,'20150101',SYSDATE,'20150101',SYSDATE); INSERT INTO COURSE VALUES(5,'22223',1,1,'20150101',SYSDATE,'20150101',SYSDATE); INSERT INTO COURSE VALUES(6,'22223',1,1,'20150101',SYSDATE,'20150101',SYSDATE); DECLARE rn number; CURSOR course_cur IS SELECT course_no FROM COURSE; --type delArray1 is table of COURSE%ROWTYPE index by binary_integer; type delArray1 is table of COURSE.COURSE_NO%TYPE index by binary_integer;--%TYPE实际对应表中一列的数据类型 cur_result delArray1; BEGIN rn := 2; OPEN course_cur; for i in 1..3 loop FETCH course_cur bulk collect into cur_result limit rn; for i in 1..rn loop print 'loop COURSE_NO1: '||cur_result(i); end loop; print 'commit ' ; END LOOP; close course_cur; END;

本文参考:http://blog.itpub.net/750077/viewspace-2075986/

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服