[8.2.1 UDB on linux]
I've got two tables, one holding the current price of a product, and
one to hold all prior versions;
CREATE TABLE product_pricing (product varchar(10), price decimal (9,
2), last_changed date);
CREATE TABLE product_pricing_history (product varchar(10), price
decimal (9, 2), start date, end date);
Every time update the price in the product_pricing table, I want the
old value to be inserted into the product_pricing_history table. So I
thought this would work:
CREATE TRIGGER price_history_tr
NO CASCADE BEFORE UPDATE OF price ON product_pricing
REFERENCING OLD as oldprice
FOR EACH ROW
BEGIN ATOMIC
INSERT INTO product_pricing_history (product, start, end, price)
VALUES (oldprice.product, oldprice.last_changed, current date,
oldprice.price);
END
However, I get back SQLSTATE 42987: The statement is not allowed in a
procedure or trigger.
Am I doing something blatantly wrong here, or should I take this up
with IBM Support? Being new to triggers, I'm working from the online
doco, and I can't see what in particular I might be doing that's wrong
(
http://publib.boulder.ibm.com/infoce...n/r0000931.htm
)