From: | Conrado Blasetti <conrado(at)mapfre(dot)com(dot)ar> |
---|---|
To: | Jaime Casanova <systemguards(at)gmail(dot)com> |
Cc: | "pgsql-es-ayuda:postgresql(dot)org" <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | RE: Exception |
Date: | 2005-12-22 19:14:00 |
Message-ID: | 65746BCC3D99E44998976FD845AD6E6E0F9B8995@MAIL |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Jaime, con el primer link que me mandaste probé el SQLSTATE pero como me
decía que la columna sqlstate no existía, probé el SLQERRM, y tampoco, me
dice que la colunoa sqlerrm no existe.
Solo hago un return 'Descripción ' || SQLSTATE; y nada...
-----Mensaje original-----
De: Jaime Casanova [mailto:systemguards(at)gmail(dot)com]
Enviado el: Jueves, 22 de Diciembre de 2005 03:59 p.m.
Para: Conrado Blasetti
CC: pgsql-es-ayuda:postgresql.org
Asunto: Re: [pgsql-es-ayuda] Exception
On 12/22/05, Conrado Blasetti <conrado(at)mapfre(dot)com(dot)ar> wrote:
> Jaime, gracias por responder.
> Con la documentación puedo aplicar:
>
> declare
>
> begin
>
>
> exception when DIVISION_BY_ZERO then
> return 'Division invalida.';
> when others then
> return 'Aca necesito catchar cualquier otro error, y necesito el Nº y la
> descripcion';
>
> end;
>
> El Oracle tengo el sqlerrm y el sqlcode, pero no encuentro el equivalente
de
> postgres.
>
> De nuevo gracias.
> Saludosm
> Conrado
>
http://www.postgresql.org/docs/current/static/plpgsql-control-structures.htm
l#PLPGSQL-ERROR-TRAPPING
"Within an exception handler, the SQLSTATE variable contains the error
code that corresponds to the exception that was raised (refer to Table
A-1 for a list of possible error codes). The SQLERRM variable contains
the error message associated with the exception. These variables are
undefined outside exception handlers."
asi que lo que buscas, que es nuevo en 8.1, serian las variables
SQLSTATE y SQLERRM
--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)
---------------------------(fin del mensaje)---------------------------
TIP 3: si publicas/lees desde Usenet, por favor envía "subscribe-nomail"
a majordomo(at)postgresql(dot)org para que tus mensajes puedan llegar
a los suscriptores de la lista
From | Date | Subject | |
---|---|---|---|
Next Message | Jaime Casanova | 2005-12-22 19:21:58 | Re: Exception |
Previous Message | Jaime Casanova | 2005-12-22 18:58:58 | Re: Exception |