How to handle "Warning: Function created with compilation errors." when create Oracle function.
For example (MYFUNC.sql):
1 CREATE OR REPLACE FUNCTION MYFUNC
2 RETURN NUMBER AS
3 MYVAR NUMBER;
4 BEGIN
5 SELECT COUNT(*) INTO MYVAR FROM MYTAB;
6 RETURN MYVAR;
7 END MYFUNC;
8 /
sql*Plus: Release 12.1.0.1.0 Production on Mon May 25 00:26:09 2015
Copyright (c) 1982,2013,Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning,OLAP,Data Mining and Real Application Testing options
Warning: Function created with compilation errors.
sql>
sql> show errors;
Errors for FUNCTION MYFUNC:
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/3 PL/sql: sql Statement ignored
5/35 PL/sql: ORA-00942: table or view does not exist
sql>
It's mean that table MYTAB does not exists.
sql> CREATE TABLE MYTAB(A INT);
Table created.
Function created.
sql>