How to fix the Oracle error PLS-00251: RETURN, for actual function return, must be last in the parameters clause?

In this post, you’ll learn more about the Oracle ErrorPLS-00251: RETURN, for actual function return, must be last in the parameters clause with the details on why you receive this error and the possible solution to fix it.

Oracle Error Description

PLS-00251: RETURN, for actual function return, must be last in the parameters clause

Reason for the Error PLS-00251: RETURN, for actual function return, must be last in the parameters clause

RETURN specification for the actual function return, used within the parameters clause must hold the very last position. Example : The following will give this error since the RETURN specification for the actual function return in the parameters clause is not the last. FUNCTION myexternalfunc (var1 BINARY_INTEGER, var2 BINARY_INTEGER) RETURN BINARY_INTEGER IS EXTERNAL NAME “myexternalfunc” LIBRARY somelib PARAMETERS (var1 LONG, var2 SHORT, RETURN INT, RETURN INDICATOR SHORT); The correct syntax is the following. Note that RETURN for actual function return is the last specification in the parameters clause. FUNCTION myexternalfunc (var1 BINARY_INTEGER, var2 BINARY_INTEGER) RETURN BINARY_INTEGER IS EXTERNAL NAME “myexternalfunc” LIBRARY somelib PARAMETERS (var1 LONG, var2 SHORT, RETURN INDICATOR SHORT, RETURN INT);

How to fix the Error PLS-00251: RETURN, for actual function return, must be last in the parameters clause ?

You can fix this error in Oracle by following the below steps

Correct the syntax of the RETURN specification in the parameters clause