Re: function DECODE and triggers

From: "Rafael Montoya" <rafo-mm(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: function DECODE and triggers
Date: 2005-10-24 22:16:33
Message-ID: BAY18-F3E144B2EDF45EA6CDBD92F8770@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-10-24 22:19:27 Re: PostgreSQL vs mySQL, any performance difference for
Previous Message Denis 2005-10-24 22:10:21 Re: cannot stat `/usr/local/pgsql/data/pg_xlog/00000001000000430000009C': No such file or directory