X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 60A979DC995 for ; Thu, 16 Mar 2006 14:14:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70810-03 for ; Thu, 16 Mar 2006 14:14:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from perseverance.encs.concordia.ca (perseverance-96.encs.concordia.ca [132.205.96.94]) by postgresql.org (Postfix) with ESMTP id 1895F9DC98E for ; Thu, 16 Mar 2006 14:14:51 -0400 (AST) Received: from [132.205.47.205] (IDENT:emilu@curacao.encs.concordia.ca [132.205.47.205]) by perseverance.encs.concordia.ca (8.12.11/8.12.11) with ESMTP id k2GIEpcY007565 for ; Thu, 16 Mar 2006 13:14:51 -0500 Message-ID: <4419AB1A.3070805@encs.concordia.ca> Date: Thu, 16 Mar 2006 13:14:50 -0500 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: About how to use "exception when ??? then " Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.43 on perseverance.encs.concordia.ca at 2006/03/16 13:14:51 EST X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.137 required=5 tests=[AWL=0.137] X-Spam-Score: 0.137 X-Spam-Level: X-Archive-Number: 200603/236 X-Sequence-Number: 24582 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