how to check SQLSTATE

From: Hugo <htakada(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how to check SQLSTATE
Date: 2006-10-05 20:45:36
Message-ID: f3d9ba990610051345t61b6c780nf79d3ea2507d3b42@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2006-10-05 20:55:55 Re: PostgreSQL Database Transfer between machines(again)
Previous Message Brian J. Erickson 2006-10-05 19:50:38 Re: PostgreSQL Database Transfer between machines(again)