This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 30356
    
150

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
 
wood burning stoves
 
subject: A doubt with triggers