From: | Alan Searles <alien(at)attglobal(dot)net> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Converting IBM DB2 TRIGGERs to PostgreSQL |
Date: | 2003-06-11 01:03:16 |
Message-ID: | 1055293396.1087.34.camel@aurora |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I am relatively new to PostgreSQL, and I am currently trying to convert
a JAVA application that currently runs under IBM's DB2.
Part of my challenge is to somehow convert the following (sample)
TRIGGER statements that work just fine under DB2.
------------------------------------------------------------------------------------------------
CREATE TRIGGER ALIEN.COUNTRY_INS
AFTER INSERT ON ALIEN.COUNTRY
REFERENCING NEW AS X
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
INSERT INTO ALIEN.COUNTRY_LOG
VALUES (X.COUNTRYID, X.FULLNAME, X.CODE,
X.UNDEFINED, X.MARKFORDELETE, X.USERID,
CURRENT TIMESTAMP, CURRENT TIMESTAMP, 'INS');
END
CREATE TRIGGER ALIEN.COUNTRY_UPD
AFTER UPDATE ON ALIEN.COUNTRY
REFERENCING NEW AS X
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
INSERT INTO ALIEN.COUNTRY_LOG
VALUES (X.COUNTRYID, X.FULLNAME, X.CODE,
X.UNDEFINED, X.MARKFORDELETE, X.USERID,
CREATED, CURRENT TIMESTAMP, 'UPD');
END
------------------------------------------------------------------------------------------------
Can this be done with PostgreSQL ? I am concerned more with the "BEGIN
ATOMIC" sections.
Any help would be appreciated. Thanks.
/Alan
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-06-11 05:25:21 | Re: Converting IBM DB2 TRIGGERs to PostgreSQL |
Previous Message | aakash chauhan | 2003-06-10 17:28:17 | Installation problem |