-1

我正在尝试从将显示表格内容的过程中返回光标invoice。包和过程已成功创建,但是当我运行该行时 -Exec CursorPckg.CursorTest_Proc();我收到以下错误component 'CURSORTEST_PROC' must be declared任何想法?我正在运行 SQL*PLUS

CREATE or REPLACE PACKAGE CursorPckg
IS
  TYPE salary_type IS REF CURSOR RETURN Invoice%ROWTYPE;
END CursorPckg;

CREATE OR REPLACE PACKAGE BODY CursorPckg AS
  PROCEDURE CursorTest_Proc (c1 OUT CursorPckg.salary_type) 
  IS
  BEGIN
    OPEN c1 FOR 
    SELECT * FROM Invoice;
  END CursorTest_Proc;
END CursorPckg;
4

1 回答 1

2

您需要在包声明中添加过程声明,以便可以从包外部访问它。像这样:

CREATE or REPLACE PACKAGE CursorPckg
IS
TYPE salary_type IS REF CURSOR RETURN Invoice%ROWTYPE;
PROCEDURE CursorTest_Proc (c1 OUT CursorPckg.salary_type);
END CursorPckg;

编辑:

回答您的评论。如果不提供 type 参数,您将无法执行此过程CursorPckg.salary_type

于 2012-12-08T17:51:52.880 回答