Home » SQL & PL/SQL » SQL & PL/SQL » Re: Warning: Package created with compilation errors.
Re: Warning: Package created with compilation errors. [message #2863] Sun, 18 August 2002 23:35 Go to next message
oranew
Messages: 6
Registered: January 2002
Junior Member
Tod,

Thanks for help. I tried quering user_errors view, but it's empty.

Following is the package:

CONNECT SCOTT/TIGER@MYORA9I;

CREATE or REPLACE PACKAGE emp_security AS
FUNCTION setid (D1 VARCHAR2, D2 VARCHAR2) RETURN VARCHAR2;
END;

CREATE OR REPLACE PACKAGE BODY emp_security AS
FUNCTION setid (D1 VARCHAR2, D2 VARCHAR2) RETURN VARCHAR2 IS
stmt VARCHAR2(200);
BEGIN
stmt := 'ename = SYS_CONTEXT("userenv","session_user")';
RETURN stmt;
END;
END;
/

I run it in sql*plus but always met this mesg:
Warning: Package created with compilation errors.

Could you pls help to check it? Thanks a lot !
Re: Warning: Package created with compilation errors. [message #2875 is a reply to message #2863] Mon, 19 August 2002 09:25 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
You are just missing a slash at the end of the package spec. See how if it is left out I get a compilation error (that I can see with 'show errors'), and if I put one in everything compiles cleanly. By the way, you want to use double single quotes instead of double quotes.

sql>CREATE or REPLACE PACKAGE emp_security AS
  2  FUNCTION setid (D1 VARCHAR2, D2 VARCHAR2) RETURN VARCHAR2;
  3  END;
  4  
  5  CREATE OR REPLACE PACKAGE BODY emp_security AS
  6  FUNCTION setid (D1 VARCHAR2, D2 VARCHAR2) RETURN VARCHAR2 IS
  7  stmt VARCHAR2(200);
  8  BEGIN
  9  stmt := 'ename = SYS_CONTEXT("userenv","session_user")';
 10  RETURN stmt;
 11  END;
 12  END;
 13  /
 
Warning: Package created with compilation errors.
 
sql>show errors
Errors for PACKAGE EMP_SECURITY:
 
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/1      PLS-00103: Encountered the symbol "CREATE"
 
sql>CREATE or REPLACE PACKAGE emp_security AS
  2  FUNCTION setid (D1 VARCHAR2, D2 VARCHAR2) RETURN VARCHAR2;
  3  END;
  4  /
 
Package created.
 
sql>CREATE OR REPLACE PACKAGE BODY emp_security AS
  2  FUNCTION setid (D1 VARCHAR2, D2 VARCHAR2) RETURN VARCHAR2 IS
  3  stmt VARCHAR2(200);
  4  BEGIN
  5  stmt := 'ename = SYS_CONTEXT("userenv","session_user")';
  6  RETURN stmt;
  7  END;
  8  END;
  9  /
 
Package body created.
Re: Warning: Package created with compilation errors. [message #2888 is a reply to message #2863] Mon, 19 August 2002 17:50 Go to previous messageGo to next message
oranew
Messages: 6
Registered: January 2002
Junior Member
Todd,

Thank you very much! It works.

But I still have one question need your help.
I still can not see anything when using 'show errors' command. Is there any switch in sqlplus I should set?

Thanks again in advance.
Re: Warning: Package created with compilation errors. [message #2899 is a reply to message #2863] Tue, 20 August 2002 09:27 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
I am not aware of any flag/switch in SQL*Plus that would suppress output from 'show errors', but I do not think that is an issue because you mentioned that you did not see anything when you directly queried user_errors.
Re: Warning: Package created with compilation errors. [message #2908 is a reply to message #2899] Tue, 20 August 2002 17:22 Go to previous message
oranew
Messages: 6
Registered: January 2002
Junior Member
Oh, yes, you are right. But can you tell me the reason why I can not see the error message? I use Oracle 9i on windows2K. Sqlplus is 8.1.7 on windows2k. Many thanks!
Previous Topic: last_ddl_time
Next Topic: CLOB and PLSQL FUNCTION
Goto Forum:
  


Current Time: Fri Mar 29 09:39:17 CDT 2024