MSCEWI3052

Exception declaration is handled by the raise function.

Severity

Low

Description

Exceptions can be defined in both languages, Oracle and Snowflake, but the RAISE function is designed to do declaration, assignment, and throw the error. This is why the Exception declaration is commented out and the warning is displayed.

Example Code

Input Code:

CREATE OR REPLACE PROCEDURE EXCEPTION_DECLARATION_SAMPLE AUTHID DEFINER IS
  NEW_EXCEPTION EXCEPTION;
  PRAGMA EXCEPTION_INIT(NEW_EXCEPTION, -63);
BEGIN

  IF true THEN
    RAISE NEW_EXCEPTION;
  END IF;

EXCEPTION
    WHEN NEW_EXCEPTION THEN
        --Handle Exceptions
END;
/

Output Code:

Recommendations

Last updated