This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes A doubt with triggers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "A doubt with triggers" Watch "A doubt with triggers" New topic
Author

A doubt with triggers

vignesh bala
Greenhorn

Joined: Aug 19, 2006
Posts: 28

Hi all,

I have a basic doubt in trigger execution. I am using JDBC to do an insert and a select queries to the same table(I am selecting the same coloumns which i inserted). The insert statement is a trigger which sets proper in the coloums(I have used some default values in insert query). I have a major doubt here.
will the trigger fired before the select statement executed or the select will be executed before trigger gets executed.Please help me. I am in urgent need of it.

Regards,
Vignesh
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

Vignesh,
It depends on how you define the trigger.

You could have either of these:
CREATE TRIGGER my_trigger BEFORE INSERT ...
CREATE TRIGGER my_trigger AFTER INSERT ...


[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
 
jQuery in Action, 2nd edition
 
subject: A doubt with triggers
 
Similar Threads
A doubt in System.out.println()
Commit problem
If doubt
Threads - doubt...
doubt