File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases 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 Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31577
    
185

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 ...


[OCA 8 book] [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: A doubt with triggers