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

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: About how to use "exception when ??? then "
Date: 2006-03-16 18:14:50
Message-ID: 4419AB1A.3070805@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

I am using PostgreSQL 8.0.1.

In a function, I try to use exception to catch sql errors:

begin
....
begin
exception
WHEN ??? THEN
end;
...
end;

The place where I have ???, what I should put there please?

e.g.,
1. WHEN sqlcode = '02000' THEN
2. WHEN no_data then
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

Please enlighten me.

Thanks,
Ying

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message alex-lists-pgsql 2006-03-16 18:39:57 executing external command
Previous Message Bryce Nesbitt 2006-03-16 17:45:10 Re: group by function, make SQL cleaner?