Re: how to check SQLSTATE - Mailing list pgsql-general

From A. Kretschmer
Subject Re: how to check SQLSTATE
Date
Msg-id 20061006051640.GA26983@a-kretschmer.de
Whole thread Raw
In response to how to check SQLSTATE  (Hugo <htakada@gmail.com>)
Responses Re: how to check SQLSTATE  (Hugo <htakada@gmail.com>)
Re: how to check SQLSTATE  (Hugo <htakada@gmail.com>)
List pgsql-general
am  Thu, dem 05.10.2006, um 17:45:36 -0300 mailte Hugo folgendes:
> Hi,
>
> is it possible to check for sqlstate inside a function , something like:
>    ....
>    loop
>       fetch bla.....
>       if sqlstate = '02000' then
>             exit;
>       end if;
>       ....
>    end loop;
>  if I try to save the above I get a :  sqlstate not defined error

Which version?

With release 8.1 you can use SQLSTATE and SQLERRM inside exception
blocks.
-> http://www.postgresql.org/docs/8.1/interactive/release-8-1.html

You can find the errorcodes there:
http://www.pgadmin.org/docs/1.4/pg/errcodes-appendix.html#errcodes-table


HTH, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: share lock error
Next
From: Richard Huxton
Date:
Subject: Re: Two efficiency questions - clustering and ints