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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to