| From: | Michael Fuhr <mike(at)fuhr(dot)org> |
|---|---|
| To: | Rafael Montoya <rafo-mm(at)hotmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: exceptions |
| Date: | 2005-10-11 18:33:21 |
| Message-ID: | 20051011183321.GA99188@winnie.fuhr.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Tue, Oct 11, 2005 at 07:24:12PM +0200, Rafael Montoya wrote:
> I'm migrating some triggers from oracle to postgresql and i can´t find the
> equivalent of the following two sentences:
> 1)
> DECLARE
> TMP_COD_PRO PRODUCT.COD_PRO%TYPE;
See "Declarations" in the PL/pgSQL documentation for the available
syntax:
http://www.postgresql.org/docs/8.0/interactive/plpgsql-declarations.html
> 2)
> EXCEPTION
> when no_data_found then null;
>
> what i tried :
>
> exception
> if not found then null;
>
> but it seems not to be correct, can anybody give me a hand?
See "Trapping Errors" in the documentation for the allowed syntax
(only available in 8.0 and later):
In PL/pgSQL, queries that return no rows don't raise a "no data"
exception. To check whether any rows were returned you can use
FOUND in an ordinary IF statement.
--
Michael Fuhr
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dan Armbrust | 2005-10-11 18:33:25 | Re: fine tuned database dump/reload? |
| Previous Message | Alex Turner | 2005-10-11 17:57:39 | Re: PostgreSQL missing in SuSE 10? |