Two Laptop Bag*
The moose likes JDBC and the fly likes Help me in creating a Trigger for Insert and Update Options  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Help me in creating a Trigger for Insert and Update Options  " Watch "Help me in creating a Trigger for Insert and Update Options  " New topic
Author

Help me in creating a Trigger for Insert and Update Options

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

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 .


Save India From Corruption - Anna Hazare.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

You add it to the "after" clause on the trigger. See the full syntax for triggers.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help me in creating a Trigger for Insert and Update Options
 
Similar Threads
Trigger Function Problem
Issue in Inserting / Updating the table with trigger using Hibernate
Need to call a Java Object / Servlet from a Trigger
A doubt with triggers
Need to Invoke a Java Program from a trigger