How to handle "Warning: Function created with compilation errors." when create Oracle function.
@H_403_3@
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 /
@H_403_3@
@H_403_3@
sql*Plus: Release 12.1.0.1.0 Production on Mon May 25 00:26:09 2015
@H_403_3@
Copyright (c) 1982,2013,Oracle. All rights reserved.
@H_403_3@
@H_403_3@
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
@H_403_3@
@H_403_3@
Warning: Function created with compilation errors.
@H_403_3@
sql>
sql> show errors;
Errors for FUNCTION MYFUNC:
@H_403_3@
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/3 PL/sql: sql Statement ignored
5/35 PL/sql: ORA-00942: table or view does not exist
sql>
@H_403_3@
It's mean that table MYTAB does not exists.
@H_403_3@
sql> CREATE TABLE MYTAB(A INT);
@H_403_3@
Table created.
@H_403_3@
@H_403_3@
Function created.
@H_403_3@
sql>