Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me in creating a Trigger for Insert and Update Options

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Please help me in creating a Trigger .

My requirement is that after insert or update on a Table , i want to fire an event .

I have started this way ,but doesn't know how to fully implement this .

say i have a dept table

CREATE TRIGGER DepartmentTrigger
AFTER INSERT ON Dept
BEGIN
INSERT INTO mytable VALUES("123","Kiran");
END DepartmentTrigger;

Please tell me how can i put the Update option also .

Thanks in advance .
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35976
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You add it to the "after" clause on the trigger. See the full syntax for triggers.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!