pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emi Lu <emilu@encs.concordia.ca>
To: pgsql-sql@postgresql.org
Subject: About how to use "exception when ??? then "
Date: Thu, 16 Mar 2006 13:14:50 -0500
Message-ID: <4419AB1A.3070805@encs.concordia.ca> (raw)

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



view thread (7+ messages)  latest in thread

Message-ID: <4419AB1A.3070805@encs.concordia.ca>
Permalink:  ../4419AB1A.3070805@encs.concordia.ca/
Also on:    postgresql.org/message-id/4419AB1A.3070805@encs.concordia.ca

 · 

reply

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: emilu@encs.concordia.ca
  Subject: Re: About how to use "exception when ??? then "
  In-Reply-To: <4419AB1A.3070805@encs.concordia.ca>

* 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