Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle Package error

Status
Not open for further replies.

ekta22

IS-IT--Management
May 3, 2004
359
US
Hi,

I have created the package below but when I try to compile it I keep getting this error-
Error(14,1): PLS-00103: Encountered the symbol "CREATE"

Any ideas why I am getting this error.
My package is below

Code:
create or replace
PACKAGE TEST_REPORT 
AS 
TYPE TEST_TYPE IS REF CURSOR RETURN EQUIPMENT%ROWTYPE;
PROCEDURE EQUIPMENT (
  TEST_CURSOR IN OUT TEST_TYPE,
  FAC_TYPE IN EQUIPMENT.FAC_TYPE%TYPE,
  FAC_IDENT IN EQUIPMENT.FAC_IDENT%TYPE
  );

END TEST_REPORT;

CREATE OR REPLACE PACKAGE BODY TEST_REPORT
AS
  PROCEDURE EQUIPMENT(
    TEST_CURSOR IN OUT TEST_TYPE,
    FAC_TYPE IN EQUIPMENT.FAC_TYPE%TYPE,
    FAC_IDENT IN EQUIPMENT.FAC_IDENT%TYPE
  ) IS
  BEGIN
    OPEN TEST_CURSOR FOR
      SELECT * FROM EQUIPMENT
      WHERE EQUIPMENT.FAC_TYPE = FAC_TYPE AND
      EQUIPMENT.FAC_IDENT = FAC_IDENT;
  END EQUIPMENT;
END TEST_REPORT;

Thaks,

-E
 
create or replace
PACKAGE TEST_REPORT
AS
TYPE TEST_TYPE IS REF CURSOR RETURN EQUIPMENT%ROWTYPE;
PROCEDURE EQUIPMENT (
TEST_CURSOR IN OUT TEST_TYPE,
FAC_TYPE IN EQUIPMENT.FAC_TYPE%TYPE,
FAC_IDENT IN EQUIPMENT.FAC_IDENT%TYPE
);

END TEST_REPORT;
/
CREATE OR REPLACE PACKAGE BODY TEST_REPORT
AS
PROCEDURE EQUIPMENT(
TEST_CURSOR IN OUT TEST_TYPE,
FAC_TYPE IN EQUIPMENT.FAC_TYPE%TYPE,
FAC_IDENT IN EQUIPMENT.FAC_IDENT%TYPE
) IS
BEGIN
OPEN TEST_CURSOR FOR
SELECT * FROM EQUIPMENT
WHERE EQUIPMENT.FAC_TYPE = FAC_TYPE AND
EQUIPMENT.FAC_IDENT = FAC_IDENT;
END EQUIPMENT;
END TEST_REPORT;
/
 
Ekta,

DBToo is absolutely correct, but in case his correction is difficult to see, it is your missing "/" following the PACKAGE header CREATE statement.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
I am still getting an error
Error(13,1): PLS-00103: Encountered the symbol "/"
 
It will create from sqlplus. Are you trying to do them both at the same time (same screen?) Try doing them seperatly.

I've never used that tool.
 
Ekta,

Part of your problem is that your references to "EQUIPMENT" are confusing Oracle: "EQUIPMENT" is a table, and "EQUIPMENT" is also the name of a procedure within your package.

By changing the name of the procedure from "EQUIPMENT" to "EQUIP", I just successfully compiled (in SQL*Plus) your package header and body with the following code:
Code:
create or replace
PACKAGE TEST_REPORT
AS
TYPE TEST_TYPE IS REF CURSOR RETURN EQUIPMENT%ROWTYPE;
PROCEDURE EQUIP (
  TEST_CURSOR IN OUT TEST_TYPE,
  FAC_TYPE IN EQUIPMENT.FAC_TYPE%TYPE,
  FAC_IDENT IN EQUIPMENT.FAC_IDENT%TYPE
  );

END TEST_REPORT;
/

Package created.

CREATE OR REPLACE PACKAGE BODY TEST_REPORT
AS
  PROCEDURE EQUIP(
    TEST_CURSOR IN OUT TEST_TYPE,
    FAC_TYPE IN EQUIPMENT.FAC_TYPE%TYPE,
    FAC_IDENT IN EQUIPMENT.FAC_IDENT%TYPE
  ) IS
  BEGIN
    OPEN TEST_CURSOR FOR
      SELECT * FROM EQUIPMENT
      WHERE EQUIPMENT.FAC_TYPE = FAC_TYPE AND
      EQUIPMENT.FAC_IDENT = FAC_IDENT;
  END EQUIP;
END TEST_REPORT;
/

Package body created.
Let us know if this helps.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
In SQL Developer I am still getting the same error.. wonder y?
 
Ekta,

What are your results in SQL*Plus if you simply copy-and-paste the code that I successfully compiled using my SQL*Plus?

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Thanks a lot for your help. It worked fine in SQL*PLUS and also in SQL Developer. It is some silly thing you need to do in SQL Developer to make it work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top