Re: PL/SQL error handling

From: Mark Powell <Mark.Powell_at_eds.com>
Date: 23 Dec 1998 14:15:57 GMT
Message-ID: <01be2e7f$18fcd660$a12c6394_at_J00679271.ddc.eds.com>


May I suggest that you look into:

SQLCODE		hold Oracle return code
SQLERRM		holds Oracle error message text
raise_application_error   	Oracle provided procedure to terminate procedure

As far as enclosing every SQL statement in a block, no. But enclose those where you need to be able to handle specific events like where a selected row may not exist, i.e., Oracle defined error no_data_found.

The calling form should check the condition of SQLCODE on return from any database stored procedure, function, or packaged code. Then it can rollback and take appropriate action.

Jochen Van den Bossche <Jochen.Van-Den-Bossche_at_eurocontrol.be> wrote in article <3680A7E9.7005_at_eurocontrol.be>...
> Putting EACH statement in a block might be overkill, but surrounding
> statements (or only one) with a seperate block is indeed a common way
> for error handling.
>
>
> Pär Andersson wrote:
> >
> > Hello!
> >
> > I would appreciate som guidelines on error handling in packages in
order to
> > make procedures and functions reuseable from both forms an batch
programs.
> >
> > Is it a good idea to put each statement into its own subblock (in
general)?
> >
> > Thanks for any help
> > Pelle
>
Received on Wed Dec 23 1998 - 15:15:57 CET

Original text of this message