From: Richard Huxton <dev@archonet.com>
To: emilu@encs.concordia.ca
Cc: pgsql-sql@postgresql.org
Subject: Re: About how to use "exception when ??? then "
Date: Thu, 16 Mar 2006 19:01:42 +0000
Message-ID: <4419B616.2040105@archonet.com> (raw)
In-Reply-To: <4419AB1A.3070805@encs.concordia.ca>
References: <4419AB1A.3070805@encs.concordia.ca>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, emilu@encs.concordia.ca
Subject: Re: About how to use "exception when ??? then "
In-Reply-To: <4419B616.2040105@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox