Re: IDS 7.31 : Managing exceptions in stored procedures
Posted in 2000
Houps !!
Sorry for asking you such a question ! I found the solution in Informix docs
(I was looking in the wrong one this morning !). As I was wondering, you
just have to declare a varchar variable and manage it just like v_errnum and
v_eisam in my exemple.
....
Arnaud ANDRIEUX wrote:
> Hi again,
>
> I need feedback on exception management within stored procedures. All of
> my procedures have the following structure :
>
> CREATE PROCEDURE myproc ( ... )
> RETURNING ...;> -- variable definition and initialization
> BEGIN
>
> -- exception management bloc
> ON EXCEPTION SET v_errnum, v_eisam
> IF v_errnum IN (...) THEN
> -- do something special
> ELSE
> RAISE EXCEPTION v_errnum, v_eisam;
> END IF;
> END EXCEPTION;
>
> -- do something
> RETURN (...);
>
> END
> END PROCEDURE;
>
> So all of the exceptions that are fired are passed out of myproc by the
> 'exception management bloc'. It works well but I loose the message part
> of the exception. For example, if the exception -268 (unique constraint
> violated) is fired, I get the folowing message in the process which
> executed myproc :
> "..... SQL error [-268] : unique constraint ( ) violated. [ISAM Error
> ...........]"
> But the message I want to get back is the following :
> "..... SQL error [-268] : unique constraint ('constraint_name')
> violated. [ISAM Error ...........]"
>
> So how is it possible to manage exceptions with keeping track of the
> complete message ? Is there a variable to SET and RAISE with v_errnum
> and v_eisam ? If yes, wich data type is it ?
>
> Thanks for your help.
>
> --
> - ------------------------------------------------------------------ -
> - Arnaud ANDRIEUX tel direct : 02.99.12.52.22 -
> - Alliance Qualite Logiciel http://www.aql.fr -
> - GROUPE SILICOMP http://www.silicomp.fr -
> - Rue de la Chataigneraie - B.P. 127 -
> - 35513 CESSON SEVIGNE - FRANCE -
> - tel : (33) (0)2.99.12.50.00 fax : (33) (0)2.99.63.70.40 -
> - ------------------------------------------------------------------ -
--
- ------------------------------------------------------------------ -
- Arnaud ANDRIEUX tel direct : 02.99.12.52.22 -
- Alliance Qualite Logiciel http://www.aql.fr -
- GROUPE SILICOMP http://www.silicomp.fr -
- Rue de la Chataigneraie - B.P. 127 -
- 35513 CESSON SEVIGNE - FRANCE -
- tel : (33) (0)2.99.12.50.00 fax : (33) (0)2.99.63.70.40 -
- ------------------------------------------------------------------ -