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

_____________________________________________________________________________________________________________________

A visitor from Latham viewed 'Show Error Returns with No errors: How to find out' 49 mins ago
A visitor from India viewed 'Oracle Imp show=y & Indexfile: How to generate sql' 54 mins ago
A visitor from Vladivostok viewed 'Data Pump impdp expdp Full, Schema, Table Level Ex' 1 hr 23 mins ago
A visitor from Los angeles viewed 'How to hide oracle passwords - sqlldr, sqlplus, ex' 1 hr 26 mins ago
A visitor from Mexico city viewed 'SQL Query to Find Out Oracle Session Details for a' 2 hrs 20 mins ago

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-25 All Rights Reserved | Site Map | Contact | Disclaimer