ORA-06512 ORA-06503: PL/SQL: Function returned without value

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
Error Description:
Select from the oracle function return the following error
SQL> select fib(3) from dual;
       *
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "STHOMAS.FIB", line 4
Solution Description:

A function must return a value when you select from the same. You have to check whether the function PLSQL code whether it is going for any exception and it is not returning any values at the end. At least a null value “return null” will fix the issue.

Here is one example:

SQL> create or replace function fib (x number) return number as
begin
        dbms_output.put_line('x');
end;
 /

Function created.

SQL>
SQL> set serveroutput on
select fib(3) from dual
       *
ERROR at line 1:
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "STHOMAS.FIB", line 4
 
Fix:
SQL> create or replace function fib (x number) return number as
begin
        dbms_output.put_line('x');
        return null;
end; 
/

Function created.

SQL>  select fib(3) from dual;
    FIB(3)
----------

X

_____________________________________________________________________________________________________________________

Website Stats

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-23 All Rights Reserved | Site Map | Contact | Disclaimer