By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,954 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,954 IT Pros & Developers. It's quick & easy.

Can I dynamically reference the table and/or column name in a triggerbody? Special Register?

P: n/a
aj
DB2 LUW latest & greatest 8.2 FP11

Is there any way to dynamically reference the table and/or column name
in a trigger body, perhaps w/ a special register or something?

SP WRITE_AT() is passed: table,PK,operation,user,column,oldval,newval

So instead of:
CREATE TRIGGER UPD_ACCT_NAME
AFTER update of name on account
referencing new as new
referencing old as old
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
CALL WRITE_AT('account',old.account_id,'U',USER,
'name',old.name,new.name) ;
END !

I want something along the lines of:
CREATE TRIGGER UPD_ACCT_NAME
AFTER update of name on account
referencing new as new
referencing old as old
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
CALL WRITE_AT(TABLE,old.account_id,'U',USER,
COLUMN,old.name,new.name) ;
END !

TIA

aj
May 24 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
AJ,

Since you already referenced it, I think you should be able to replace
the TABLE parameter with "new" (w/o quotes) in your WRITE_AT SP
call.

FYI:
To avoid confusion, I would reference like that
CREATE TRIGGER UPD_ACCT_NAME
AFTER update of name on account
REFERENCING new as n ..................

and use it like this
CALL WRITE_AT(n,............

But I am clueless about replacement for COLUMN.

Regards,

Mehmet Baserdem

May 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.