1.

Predefined Exceptions in PL/SQL

Answer»

If a PL/SQL program violate the rule of Oracle, then an exception is raised. The exceptions are handled by name, for example, DUP_VAL_ON_INDEX exceptions is raised when an attempt is MADE to store duplicate VALUES in a database column CONSTRAINED by a unique index.

Let us learn about the predefined exceptions in PL/SQL:

  • ACCESS_INTO_NULL

This exception is raised when an attempt is made to the attributes of an uninitialized object.

  • CASE_NOT_FOUND

This exception is raised when none of the choices in the WHEN clause of a CASE statement is selected and there is no ELSE clause.

  • COLLECTION_IS_NULL

This exception is raised when an attempt is made to apply collection methods other than EXISTS to an uninitialized nested table or varray.

  • DUP_VAL_ON_INDEX

This exception is raised when duplicate values are ATTEMPTED to be stored in a column with unique index.

  • INVALID_CURSOR

This exception is raised when attempts are made to make a cursor operation that is not allowed, such as closing an unopened cursor.

  • INVALID_NUMBER

This exception is raised when the CONVERSION of a character string into a number fails because the string does not represent a valid number.

  • LOGIN_DENIED

This exception is raised when a program attempts to log on to the database with an invalid username or password.

  • NO_DATA_FOUND

This exception is raised when a SELECT INTO statement returns no rows.

  • NOT_LOGGED_ON

This exception is raised when a database call is issued without being connected to the database.

  • PROGRAM_ERROR

This exception is raised when there is an internal problem.

  • ROWTYPE_MISMATCH

This exception is raised when a cursor fetches value in a variable having incompatible data type.

  • SELF_IS_NULL

This exception is raised when a member method is invoked, but the instance of the object type was not initialized.

  • STORAGE_ERROR

This exception is raised when PL/SQL ran out of memory.

  • TOO_MANY_ROWS

This exception is raised when SELECT INTO statement returns more than one row.

  • VALUE_ERROR

This exception is raised when arithmetic, conversion, or truncation error occurs.

  • ZERO_DIVIDE

This exception is raised when an attempt is made to divide a number by zero.



Discussion

No Comment Found