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