|
I have an application written for version 8 that uses an INSTEAD OF
trigger, and I need to convert it to support someone that needs it for
v7. Is there a way to achieve similar functionality in v7. Here's an
example -
View on Base Table -
CREATE VIEW BASE_TABLE_VIEW AS SELECT
col1,
myUDF(col2),
col3)
FROM BASE_TABLE
Trigger on Base Table -
CREATE TRIGGER BASE_TABLE_TRGI NO CASCADE BEFORE INSERT ON
BASE_TABLE REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
DECLARE new_name varchar(50);
SET new_name = myOtherUDF(col2);
SET n.col2 = new_name;
END
If I try to insert into the view, I get an error -
SQL0151N The column "COL2" cannot be updated. SQLSTATE=42808
Of course, if I update the base table directly, it works fine, but if
possible I'd like to avoid updating the application code, which I
don't have access to, and just modify views, triggers etc. that I do
have access to.
Thanks! |