The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.
Thanks for the question.
Asked: September 02, 2015 - 9:37 am UTC
Last updated: September 15, 2015 - 2:20 am UTC
Version: Oracle Database: 11.2.0.1
Viewed 1000+ times
CREATE OR REPLACE PACKAGE GET_ALL_PACK AS RetCusor SYS_REFCURSOR; PROCEDURE GET_ALLCUST(AllCust OUT SYS_REFCURSOR); END GET_ALL_PACK; / CREATE OR REPLACE PACKAGE BODY GET_ALL_PACK AS RetCusor SYS_REFCURSOR; PROCEDURE GET_ALLCUST(AllCust OUT SYS_REFCURSOR) IS begin OPEN RetCusor FOR SELECT * FROM Customer; end; END GET_ALL_PACK;
PLS-00994: Cursor Variables cannot be declared as part of a package
CREATE OR REPLACE PACKAGE GET_ALL_PACK AS PROCEDURE GET_ALLCUST(AllCust OUT SYS_REFCURSOR); END GET_ALL_PACK; / show err No errors. CREATE OR REPLACE PACKAGE BODY GET_ALL_PACK AS PROCEDURE GET_ALLCUST(AllCust OUT SYS_REFCURSOR) IS RetCusor SYS_REFCURSOR; begin OPEN RetCusor FOR SELECT * FROM Customer; end; END GET_ALL_PACK; / show err No errors.
Kim Berg Hansen, September 02, 2015 - 10:23 am UTC
CREATE OR REPLACE PACKAGE GET_ALL_PACK AS PROCEDURE GET_ALLCUST(AllCust OUT SYS_REFCURSOR); END GET_ALL_PACK; / CREATE OR REPLACE PACKAGE BODY GET_ALL_PACK AS PROCEDURE GET_ALLCUST(AllCust OUT SYS_REFCURSOR) IS begin OPEN AllCust FOR SELECT * FROM Customer; end GET_ALLCUST; END GET_ALL_PACK; /
Check out more PL/SQL tutorials on our LiveSQL tool.
PL/SQL reference manual from the Oracle documentation library