This RETURN statement does not specify a value to return, but the function was declared with a RETURNING clause that specified other than VOID. If you want to terminate a function early without producing a value, you could put a label on the END FUNCTION statement and use a GOTO, or redesign the function logic to avoid the need for an early exit.