Re: Exception

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: Conrado Blasetti <conrado(at)mapfre(dot)com(dot)ar>
Cc: "pgsql-es-ayuda:postgresql(dot)org" <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Exception
Date: 2005-12-22 18:58:58
Message-ID: c2d9e70e0512221058h77e9088ci2e7306f9a4dc2ea0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

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.html#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 ;)

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Conrado Blasetti 2005-12-22 19:14:00 RE: Exception
Previous Message Conrado Blasetti 2005-12-22 18:53:48 RE: Exception