Oracle Error Message
PLS-00508: The expression in a RETURN statement cannot be a type
Reason for the Error
A datatype specifier was used instead of an expression in the RETURN statement of a user-defined function, as shown in the example below. Do not confuse the RETURN statement, which sets the function identifier to the result value, with the RETURN clause, which specifies the datatype of the result value. FUNCTION credit-rating (acct_no NUMBER) RETURN BOOLEAN IS BEGIN … RETURN NUMBER; — should be an expression END;
Solution
Replace the datatype specifier in the RETURN statement with an appropriate expression.