Please consider the following code (query.sql):
create or replace function age (dateOfBirth date)
return number
is
mAge number(5,2);
begin
mAge:=(sysdate-dateOfBirth)/365.25;
return mAge;
end;
SQL> @query.sql
13
14
15 /
Warning: Function created with compilation errors.
And when I click on Show error, I get the following:
Code:
SQL> show error
Errors for FUNCTION AGE:
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/8 PL/SQL: Item ignored
5/15 PLS-00325: non-integral numeric literal 5.2 is inappropriate in
this context
8/8 PL/SQL: Statement ignored
8/8 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
9/5 PL/SQL: Statement ignored
9/12 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
LINE/COL ERROR
-------- -----------------------------------------------------------------
I tried to do the following from : Oracle Procedure
1) SQL> set role none;
and
2) SELECT ON DBA_TAB_COLUMNS;
But the second query above is throwing error : Missing expression.
Please let me know what's wrong with all of the above stuff.
Thanks