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

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: About how to use "exception when ??? then "
Дата
Msg-id 4419B616.2040105@archonet.com
обсуждение исходный текст
Ответ на About how to use "exception when ??? then "  (Emi Lu <emilu@encs.concordia.ca>)
Ответы Re: About how to use "exception when ??? then "  (Emi Lu <emilu@encs.concordia.ca>)
Список 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: executing external command
Следующее
От: Emi Lu
Дата:
Сообщение: Re: About how to use "exception when ??? then "