Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL and exception handling

Re: PL/SQL and exception handling

From: Dan Clamage <clamage_at_mime.dw.lucent.com>
Date: 1997/10/30
Message-ID: <01bce51e$5420da30$54110b87@clamagent>#1/1

> I am trying to find out the best way to handle exceptions:
> EXCEPTION
> WHEN OTHERS THEN
> ...process exception...
> Does the above block of code detect most if not all errors which can
> occur with PL/SQL stored procedures and functions?
This is the "catch-all" for ANY exception that might occur. Package STANDARD pre-defines these Oracle database exceptions:

  CURSOR_ALREADY_OPEN	-6511
  DUP_VAL_ON_INDEX	-0001
  TIMEOUT_ON_RESOURCE	-0051
  INVALID_CURSOR		-1001
  NOT_LOGGED_ON		-1012
  LOGIN_DENIED		-1017
  NO_DATA_FOUND		+100
  ZERO_DIVIDE		-1476
  INVALID_NUMBER		-1722
  TOO_MANY_ROWS		-1422
  STORAGE_ERROR		-6500
  PROGRAM_ERROR		-6501
  VALUE_ERROR		-6502

You can associate exception names for other Oracle-generated exceptions as you see fit. You can also define application-specific exceptions and raise them yourself. You can use these exception names in the exception handler to do something different for each one. You can OR them to do the same thing for more than one execption.
- djc Received on Thu Oct 30 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US