If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Can we create trigger like this in DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-17-09, 14:31
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Can we create trigger like this in DB2

Hi all,

Is it possible to create trigger AFTER INSERT OR UPDATE
in DB2

Code:
CREATE TRIGGER DB2ADMIN.CLIENT_TOTALS
AFTER INSERT OR UPDATE 
ON TRANSACTION
REFERENCING NEW AS N OLD AS O
FOR EACH ROW
MODE DB2SQL
If not then is there a way around


Thanks

DBFinder
Reply With Quote
  #2 (permalink)  
Old 02-17-09, 14:53
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by DBFinder
Is it possible to create trigger AFTER INSERT OR UPDATE
No.
Quote:
Originally Posted by DBFinder
If not then is there a way around
Create two triggers - on on insert, another on update.
Reply With Quote
  #3 (permalink)  
Old 02-17-09, 14:58
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thanks,

Will do that.

Your clue was important to confirm myself

Thanks again
DBFinder
Reply With Quote
  #4 (permalink)  
Old 02-17-09, 15:44
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Have a look at the syntax diagrams in the manual. If you can not map your syntax to the diagrams, then your syntax is not permissible.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development

Last edited by stolze; 02-18-09 at 19:13.
Reply With Quote
  #5 (permalink)  
Old 02-18-09, 12:46
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thanks Stolze,

One senior had clued me the code that seemed odd to me.
My best trust is dbforums where yourself , n_i , ARWinner are few to mention.

Thanks again
DBFinder
Reply With Quote
  #6 (permalink)  
Old 02-18-09, 13:09
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by DBFinder

One senior had clued me the code that seemed odd to me.
Let me guess - that person has Oracle background, not DB2.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On