Search Postgresql Archives

Re: exceptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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):

http://www.postgresql.org/docs/8.0/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

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

---------------------------(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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux