oracle的游标open动态接收数组
使用实例:
DECLARE
TYPE CUR_MODEL_TYPE IS REF CURSOR;
C1 CUR_MODEL_TYPE;
V_TASK_CODE VARCHAR2(1000);
V_DRAW_TYPE VARCHAR2(1000);
BEGIN
FOR CUR IN (SELECT T.BIZ_CODE, T.BIZ_TYPE_ID
FROM DM) LOOP
OPEN C1 FOR 'select distinct task_code,draw_type
from dual';
LOOP
FETCH C1
INTO V_TASK_CODE, V_DRAW_TYPE;
EXIT WHEN C1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(V_TASK_CODE);
END LOOP;
CLOSE C1;
END LOOP;
END;
主要实现代码:
定义 TYPE CUR_MODEL_TYPE IS REF CURSOR; C1 CUR_MODEL_TYPE;
定义游标的变量
循环遍历OPEN C1 FOR sql
;