Why Oracle let function(basic/nopipelined) without RETURN compile, and throws error in execution.
As we know pipelined function doesn't require Return, because of its working and for best programming practice we write it.
But below is not the case so why does it get compile, is there something else expected by Oracle.
Please guide/help me to dissect this behaviour.
SQL> create or replace function fn_compile
2 return number
3 is
4 Begin
5 null; --Nothing to do
6 Exception
7 when others then
8 raise_application_error(-20001,SQLERRM);
9 End;
10 /
Function created.
SQL> -- Why does above function get sucessfully compiled. It is not pipelined though
SQL> -- Now, execution will throw error
SQL> select fn_compile from dual;
select fn_compile from dual
*
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "POCUSER.FN_COMPILE", line 5