The RETURN statement terminates the current function, procedure, or anonymous block and returns control to the caller.

The RETURN statement is available in two forms. The first form of the RETURN statement is used to terminate a procedure or function that returns void. The following example shows the syntax of the first form:

RETURN;

The second form of the RETURN statement returns a value to the caller. The following example shows the syntax of the second form:

RETURN expression;

expression must evaluate to the same data type as the return type of the function.

The following example uses the RETURN statement to return a value to the caller:

CREATE OR REPLACE FUNCTION emp_comp (
    p_sal           NUMBER,
    p_comm          NUMBER
) RETURN NUMBER
IS
BEGIN
    RETURN (p_sal + NVL(p_comm, 0)) * 24;
END emp_comp;