Heya all,

I'm kinda new to pl/sql and while going through some trial-and-error period I encountered the following problem:

I can execute the following pl/sql code and get a result (pasted from sqlplus):

SQL> DECLARE
2 V_ENAME EMP.ENAME%TYPE;
3 BEGIN
4 SELECT ENAME
5 INTO V_ENAME
6 FROM EMP
7 WHERE EMPNO=7900;
8 DBMS_OUTPUT.PUT_LINE(V_ENAME);
9 END;
10 /
JAMES

PL/SQL procedure successfully completed.


BUT, Whenever I try to put this code as a procedure in a package I get "Warning: Package Body created with compilation errors."
This is the pl/sql code for the package:

CREATE OR REPLACE PACKAGE testing AS
PROCEDURE test;
END testing;
/
--comment: the above code completes successfuly

CREATE OR REPLACE PACKAGE BODY testing AS
PROCEDURE test IS
DECLARE
V_ENAME EMP.ENAME%TYPE;
BEGIN
SELECT ENAME
INTO V_ENAME
FROM EMP
WHERE EMPNO=7900;
DBMS_OUTPUT.PUT_LINE(V_ENAME);
END test;
END testing;
/
--comment: the above code returns Warning.

I also tried to "SHOW ERRORS PROCEDURE test" and got "No Errors".

Does anyone have an idea of why as a pl/sql the code works but as a procedure within a package it doesn't?

Thanks in advance!
-Pyrocks