Re: function DECODE and triggers - Mailing list pgsql-general

From Rafael Montoya
Subject Re: function DECODE and triggers
Date
Msg-id BAY18-F3E144B2EDF45EA6CDBD92F8770@phx.gbl
Whole thread Raw
In response to Re: From oracle to postgresql...  (Richard Huxton <dev@archonet.com>)
Responses Re: function DECODE and triggers
List pgsql-general
I'm migrating from oracle to postgresl, and i  have these 2 problems:

1.
PostgreSQL doesn't support function DECODE from Oracle, but it can be
replicated with
CASE WHEN expr THEN expr [...] ELSE expr END  , the problem appears when i
want to convert this sentence from oracle to postgresl:
               select decode (pre.C_GEN,'01','M','02','F','') as GENERO
my convertion is
              case when  pre.C_GEN = '01' then GENERO='M' else GENERO='F'
end ,
but i dont' know if the assigment of GENERO is correct.

2.
Writing triggers i don't know if postgresql supports statements like this:
    CREATE OR REPLACE TRIGGER trig
    AFTER UPDATE OF column2              <<----- Here is the doubt
    ON table_product
    FOR EACH ROW
    BEGIN
    ...
    END

In postgresql:
   CREATE OR REPLACE TRIGGER trig
   AFTER UPDATE OF column2               <<----- is this correct?
   ON table_product
   FOR EACH ROW EXECUTE PROCEDURE trig();

Thanks for your answers..
Rafael

_________________________________________________________________
¿Estás pensando en cambiar de coche? Todas los modelos de serie y extras en
MSN Motor. http://motor.msn.es/researchcentre/


pgsql-general by date:

Previous
From: "Denis"
Date:
Subject: Re: cannot stat `/usr/local/pgsql/data/pg_xlog/00000001000000430000009C': No such file or directory
Next
From: Scott Marlowe
Date:
Subject: Re: PostgreSQL vs mySQL, any performance difference for