TYPE REF游标名 IS REF CURSOR RETURN 表名.字段名%TYPE
沐紫之蓝 2016-03-28 11:33:16 DECLARE
TYPE refcur_ee IS REF CURSOR RETURN crmdev.crm_user_info_ceshi.user_id%TYPE; --带返回值
refcur_e refcur_ee; --定义动态游标的变量
--vTemp_e refcur_e%Type;
vTemp_e refcur_e.user_id%Type;
-- v_emp crmdev.crm_user_info_ceshi%ROWTYPE;
BEGIN
OPEN refcur_e FOR
SELECT user_id FROM crmdev.crm_user_info_ceshi;
LOOP
FETCH refcur_e INTO vTemp_e;
EXIT WHEN refcur_e%NOTFOUND;
dbms_output.put_line(refcur_e%ROWCOUNT || ' ' || vTemp_e);
END LOOP;
CLOSE refcur_e;
END;
总的程序如上,执行之后会出现下面的错误,但我是照教程一点一点改的啊,问题出在哪呢
ORA-06550: line 3, column 26:
PLS-00362: invalid cursor return type; 'CRMDEV.CRM_USER_INFO_CESHI.USER_ID%TYPE' must be a record type
ORA-06550: line 3, column 8:
PL/SQL: Item ignored
ORA-06550: line 9, column 16:
PLS-00487: Invalid reference to variable 'REFCUR_E'
ORA-06550: line 9, column 16:
PL/SQL: Item ignored
ORA-06550: line 28, column 29:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 28, column 9:
PL/SQL: SQL Statement ignored
ORA-06550: line 30, column 58:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 30, column 9:
PL/SQL: Statement ignored