am Thu, dem 05.10.2006, um 17:45:36 -0300 mailte Hugo folgendes: > Hi, > > is it possible to check for sqlstate inside a function , something like: > .... > loop > fetch bla..... > if sqlstate = '02000' then > exit; > end if; > .... > end loop; > if I try to save the above I get a : sqlstate not defined error Which version? With release 8.1 you can use SQLSTATE and SQLERRM inside exception blocks. -> http://www.postgresql.org/docs/8.1/interactive/release-8-1.html You can find the errorcodes there: http://www.pgadmin.org/docs/1.4/pg/errcodes-appendix.html#errcodes-table HTH, Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net