Re: how to check SQLSTATE

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: how to check SQLSTATE
Date: 2006-10-06 05:16:42
Message-ID: 20061006051640.GA26983@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2006-10-06 07:32:57 Re: Installation on mandriva 2006
Previous Message Tom Lane 2006-10-06 05:04:56 Re: share lock error