Search Postgresql Archives

Re: function DECODE and triggers

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

 



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/


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

[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