Thursday, February 18, 2010

PL/SQL Errors

In PL/SQL, a warning or error condition is called an exception.

Some Predefined Exceptions
  • VALUE_ERROR Exception is raised whenever PL/SQL runtime engine tries to execute a numeric FOR loop and either the low or high expression in the loop’s header evaluates to NULL. Use the COUNT method to ensure that the FOR loop is executed only when there is something in the collection. Here is the sample code:
    IF names_in.COUNT > 0 THEN
    FOR indx IN names_in.FIRST .. names_in.LAST
  • ZERO_DIVIDE Exception - Program attempts to divide a number by zero.
  • DUP_VAL_ON_INDEX Exception - Program attempts to store duplicate values in a database column that is constrained by a unique index.

0 comments:

Post a Comment