how to check SQLSTATE - Mailing list pgsql-general

From Hugo
Subject how to check SQLSTATE
Date
Msg-id f3d9ba990610051345t61b6c780nf79d3ea2507d3b42@mail.gmail.com
Whole thread Raw
Responses Re: how to check SQLSTATE
List pgsql-general
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

Then I tried this with no success:

   ....
   loop
      Begin
           fetch bla.....
           Exception
                     when no_data then
                                  exit;
     end;
      ....
   end loop; 
when I tried to save the trigger I got this:  unrecognized exception condition "no_data"
but according to the help docs, no_data is a valid symbol.

could anybody give me some hints


thanks

Hugo

pgsql-general by date:

Previous
From: "Brian J. Erickson"
Date:
Subject: Re: PostgreSQL Database Transfer between machines(again)
Next
From: Ron Johnson
Date:
Subject: Re: PostgreSQL Database Transfer between machines(again)