簡單測試動態遊標(REF CURSOR)的使用

chance2000發表於2006-06-14
SET SERVEROUTPUT ON
DECLARE
TYPE TCUR IS REF CURSOR;
CUR TCUR;
AC_WHERE VARCHAR2(100);
AC VARCHAR2(100);
BEGIN
AC_WHERE := '(31044,31048)';
OPEN CUR FOR 'SELECT OBJECT_ID FROM USER_OBJECTS WHERE OBJECT_ID IN '|| AC_WHERE;
LOOP
FETCH CUR INTO AC;
EXIT WHEN CUR%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(AC);
END LOOP;
CLOSE CUR;
END;
/[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/802415/viewspace-842461/,如需轉載,請註明出處,否則將追究法律責任。

相關文章