Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > IBM DB2 > can a trigger d...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 8822 of 9056
Post > Topic >>

can a trigger do an execute immediate?

by Oliver <JOHolloway@[EMAIL PROTECTED] > Apr 23, 2008 at 12:25 PM

I'm fairly new to DB2.

I have been assigned to build a delete trigger that finds the data
type of each of the table's fields so that the trigger can then build
a string consisting of OLD values pre-wrapped in quote marks as
needed.  The deleted record's field values, all strung together as a
single string, would then be inserted into a single archiving table
(an architecture I inherited and cannot change).

I've got the trigger doing what I want, except for the last part where
I want it to execute the insert statement.  I can't even get it to run
something simple like this, where test_table has three fields.

create trigger trd_test_table
  after delete on test_table
  referencing old as o
  for each row
  mode db2sql
begin
  execute immediate 'insert into test_table (1961, ''blackhawks'',
''stanley cup champions'')';
end;

When I try to use EXECUTE IMMEDIATE from a  _stored procedure_, it
works fine.  I'm hoping that I'm missing some syntax or some basic
concept.  Or is it that triggers aren't allowed to do EXECUTE
IMMEDIATE?

Anyone have any pointers on the overall goal?
 




 8 Posts in Topic:
can a trigger do an execute immediate?
Oliver <JOHolloway@[EM  2008-04-23 12:25:10 
Re: can a trigger do an execute immediate?
Lennart <Erik.Lennart.  2008-04-23 13:06:21 
Re: can a trigger do an execute immediate?
Oliver <JOHolloway@[EM  2008-04-23 13:21:18 
Re: can a trigger do an execute immediate?
Serge Rielau <srielau@  2008-04-23 18:29:12 
Re: can a trigger do an execute immediate?
Lennart <Erik.Lennart.  2008-04-23 20:33:22 
Re: can a trigger do an execute immediate?
"Dave Hughes" &  2008-04-23 22:41:53 
Re: can a trigger do an execute immediate?
Lennart <Erik.Lennart.  2008-04-24 04:01:43 
Re: can a trigger do an execute immediate?
Oliver <JOHolloway@[EM  2008-04-24 06:00:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 21:53:13 CDT 2008.