Force 6009 Warning as a Compile Error
ALTER SESSION SET plsql_warnings = 'Error:6009'
Statement processed.
A RETURN is Not a Re-raise - FAIL!
CREATE OR REPLACE FUNCTION plw6009
RETURN VARCHAR2
AS
BEGIN
RETURN 'abc';
EXCEPTION
WHEN OTHERS
THEN
RETURN 'abc';
END plw6009;
Error at line 7: PLS-06009: procedure "PLW6009" OTHERS handler does not end in RAISE or RAISE_APPLICATION_ERRORMore Details: https://docs.oracle.com/error-help/db/ora-06009
A Re-raise of the Current Exception - OK!
CREATE OR REPLACE FUNCTION plw6009
RETURN VARCHAR2
AS
BEGIN
RETURN 'abc';
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END plw6009;
Function created.
Raise a New Error - OK!
CREATE OR REPLACE FUNCTION plw6009
RETURN VARCHAR2
AS
BEGIN
RETURN 'abc';
EXCEPTION
WHEN OTHERS
THEN
RAISE_APPLICATION_ERROR (-20000, 'I am raising an exception!');
END plw6009;
Function created.