Thursday , November 21 2024

Oracle PL/SQL Exception

This article contains information about Oracle PL/SQL Exception and Types such as system defined, user defined.

What is Exception in Oracle PL/SQL?

These are the structures used for the management of errors that occur during the execution of commands.

Oracle PL/SQL Exception Types

  • System-defined
  • User-defined

The use of the PL / SQL Exception structure is as follows.

Sample Exception Usage is as follows;

System Defined Exceptions in Oracle PL/SQL

The Exception type previously created by Oracle PL / SQL is called System defined.

System-defined exception types are listed below.

  • ACCESS_INTO_NULL
  • ASE_NOT_FOUND
  • COLLECTION_IS_NULL
  • DUP_VAL_ON_INDEX
  • INVALID_CURSOR
  • INVALID_NUMBER, LOGIN_DENIED
  • NO_DATA_FOUND
  • NOT_LOGGED_ON
  • PROGRAM_ERROR
  • ROWTYPE_MISMATCH
  • SELF_IS_NULL
  • STORAGE_ERROR
  • TOO_MANY_ROWS
  • VALUE_ERROR
  • ZERO_DIVIDE

User Defined Exceptions in Oracle PL/SQL

Oracle also allows custom exception definition. These Exception types are called user defined exceptions. You can create User Defined Exception as follows.

We can set a special error code for the exception as follows.

The occured error can be triggered by RAISE.

The RAISE_APPLICATION_ERROR function takes the “error code”, “error message”, and “whether the error should be replaced with existing errors” as parameters to create a custom error.

You can find more detailed information about below topics in the below link.

PL/SQL Tutorial

You will find below topics in this article.

  1. What is PL/SQL
  2. Oracle PL/SQL Data Types and Variables and Literals
  3. Oracle PL/SQL Operators
  4. Oracle PL/SQL Conditional Statements
  5. Oracle PL/SQL Loops
  6. Oracle PL/SQL Procedures and Procedure Parameters
  7. Oracle PL/SQL Functions
  8. Oracle PL/SQL Cursor
  9. Oracle PL/SQL Records
  10. Oracle PL/SQL Exception
  11. Oracle PL/SQL Trigger
  12. Oracle PL/SQL Packages
  13. Oracle PL/SQL Collections

You can find more information about exception at docs.oracle.com

Loading

About Yusuf SEZER

Leave a Reply

Your email address will not be published. Required fields are marked *