我有一个IN OUT参数和一个参考光标作为存储过程的返回值。目前我正在做下面的事情。Oracle参考光标以及输出参数
create table dept
(dept_id number,
name varchar2(40),
location varchar2(200)
);
CREATE OR REPLACE PACKAGE HR.SP_PACKAGE AS
TYPE dept_type IS REF CURSOR RETURN HR.dept%ROWTYPE;
END SP_PACKAGE;
CREATE OR REPLACE PROCEDURE HR.MIXED_IN_INOUT_REF_PARAM
(
P_ID IN NUMBER
, P_NAME_TO_LOCATION IN OUT VARCHAR2
, P_RCURSOR OUT SP_PACKAGE.dept_type
) AS
BEGIN
SELECT name INTO P_NAME_TO_LOCATION FROM HR.dept WHERE dept_id = p_id AND name = P_NAME_TO_LOCATION;
OPEN P_RCURSOR FOR
select *
from HR.dept;
END MIXED_IN_INOUT_REF_PARAM;
即使编译成功,我在运行时遇到了一些错误。
ORA-06550: line 4, column 17:
PLS-00201: identifier 'CURSOR' must be declared
ORA-06550: line 4, column 13:
PL/SQL: Item ignored
ORA-06550: line 12, column 18:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 9, column 3:
PL/SQL: Statement ignored
ORA-06550: line 21, column 17:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 21, column 3:
PL/SQL: Statement ignored
我正在使用Sql Developer。任何帮助表示赞赏。
你确定它们都是创建和编译的请重新确认 – shareef 2012-08-12 09:02:12
包定义中有一个小问题。通过删除数据库限定符(例如:CREATE OF REPLACE PACKAGE SP_PACKAGE AS ..)来解决这个问题。现在他们都编译和打包,程序显示为已创建。 – chamibuddhika 2012-08-12 14:08:09
请编辑你的文章,并包含发出调用PL/SQL过程的代码。谢谢。 – 2012-08-12 15:13:08