Re: About how to use "exception when ??? then "

From: Richard Huxton <dev(at)archonet(dot)com>
To: emilu(at)encs(dot)concordia(dot)ca
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: About how to use "exception when ??? then "
Date: 2006-03-16 19:01:42
Message-ID: 4419B616.2040105@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Emi Lu wrote:
> exception
> WHEN ??? THEN

> The place where I have ???, what I should put there please?
>
> e.g.,
> 1. WHEN sqlcode = '02000' THEN
> 2. WHEN no_data then

no_data

See ch 35.7.5. "Trapping Errors" for an example

> 3. other ways?
>
> From the 8.0 docs, I am not be able to find Constant values of all
> error codes.
> http://www.postgresql.org/docs/8.0/static/errcodes-appendix.html

From the page:
"The PL/pgSQL condition name for each error code is the same as the
phrase shown in the table, with underscores substituted for spaces. For
example, code 22012, DIVISION BY ZERO, has condition name
DIVISION_BY_ZERO. Condition names can be written in either upper or
lower case. (Note that PL/pgSQL does not recognize warning, as opposed
to error, condition names; those are classes 00, 01, and 02.)"

I don't know if any have changed in 8.1, but there is a list of the
codes in that version of the docs.
http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html
--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2006-03-16 19:29:09 Re: executing external command
Previous Message alex-lists-pgsql 2006-03-16 18:39:57 executing external command