一个类型集合操作SYS_REFCURSOR的例子
2010-12-22 09:11 Tracy. 阅读(1575) 评论(0) 编辑 收藏 举报/* Formatted on 12/22/2010 9:08:42 AM (QP5 v5.163.1008.3004) */
CREATE OR REPLACE TYPE array_1 IS TABLE OF NUMBER;
CREATE OR REPLACE PROCEDURE test_refcursor (c1 OUT SYS_REFCURSOR)
AS
a1 array_1;
BEGIN
SELECT (DBMS_RANDOM.VALUE (1, 3))
BULK COLLECT INTO a1
FROM DUAL
CONNECT BY LEVEL <= 10;
FOR i IN 1 .. a1.COUNT
LOOP
DBMS_OUTPUT.put_line ('i=' || i || ' A=' || a1 (i));
END LOOP;
DBMS_OUTPUT.put_line ('-----------------');
---
OPEN c1 FOR SELECT * FROM TABLE (a1);
END;
/
DECLARE
c SYS_REFCURSOR;
BEGIN
test_refcursor (c);
END;
本文来自博客园,作者:Tracy.,转载请注明原文链接:https://www.cnblogs.com/tracy/archive/2010/12/22/1913368.html