Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Packaged cursor problem
I'm trying to declare Packaged cursor which will retrieve only one field from the table. Can anybody tell me what am I missing
I will really appreciate any suggestion
Paul
###### FIRST TRY ####################################################
CREATE OR REPLACE PACKAGE pac1 AS
CURSOR cur1 RETURN charge.ban%TYPE;
END pac1;
/
CREATE OR REPLACE PACKAGE BODY pac1 AS
CURSOR cur1 RETURN charge.ban%TYPE IS select ban from charge;
END pac1;
/
SQL> @pp7
Warning: Package created with compilation errors.
Warning: Package Body created with compilation errors.
SQL> show error
Errors for PACKAGE BODY PAC1:
LINE/COL ERROR
0/0 PL/SQL: Compilation unit analysis terminated 1/14 PLS-00905: object TSTAPP1.PAC1 is invalid 1/14 PLS-00304: cannot compile body of 'PAC1' without its specification ##################################################################### ###### SECOND TRY ###################################################
CREATE OR REPLACE PACKAGE pac1 AS
-- CURSOR cur1 RETURN charge.ban%TYPE;
END pac1;
/
CREATE OR REPLACE PACKAGE BODY pac1 AS
CURSOR cur1 RETURN charge.ban%TYPE IS select ban from charge;
END pac1;
/
SQL> @pp7
Package created.
Warning: Package Body created with compilation errors.
SQL> show error
Errors for PACKAGE BODY PAC1:
LINE/COL ERROR
2/3 PL/SQL: Item ignored 2/22 PLS-00320: the declaration of the type of this expression is incomplete or malformed ##################################################################### ###### THIRD TRY ####################################################
CREATE OR REPLACE PACKAGE pac1 AS
-- CURSOR cur1 RETURN charge.ban%TYPE;
END pac1;
/
CREATE OR REPLACE PACKAGE BODY pac1 AS
CURSOR cur1 RETURN tstapp1.charge.ban%TYPE IS select ban from charge;
END pac1;
/
/* Using dbname with the type decl, the result remains the same as in
SECOND TRY */
##################################################################### ######## ONE MORE TRY ###############################################
CREATE OR REPLACE PACKAGE pac1 AS
TYPE charge_rec IS RECORD (charge.ban%TYPE);
SQL> @pp7
Warning: Package created with compilation errors.
Warning: Package Body created with compilation errors.
SQL> show error
Errors for PACKAGE BODY PAC1:
LINE/COL ERROR
0/0 PL/SQL: Compilation unit analysis terminated 1/14 PLS-00905: object TSTAPP1.PAC1 is invalid 1/14 PLS-00304: cannot compile body of 'PAC1' without its specification ##################################################################### # LAST TRY ##########################################################
CREATE OR REPLACE PACKAGE pac1 AS
-- TYPE charge_rec IS RECORD (charge.ban%TYPE);
-- CURSOR cur1 RETURN NUMBER;
END pac1;
/
CREATE OR REPLACE PACKAGE BODY pac1 AS
CURSOR cur1 RETURN NUMBER IS select ban from charge;
END pac1;
/
SQL> @pp7
Package created.
Warning: Package Body created with compilation errors.
SQL> show error
Errors for PACKAGE BODY PAC1:
LINE/COL ERROR
2/3 PL/SQL: Item ignored 2/22 PLS-00320: the declaration of the type of this expression is incomplete or malformed #####################################################################
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sat Nov 27 1999 - 00:23:02 CST