aspose file tools*
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
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30780
    
157

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A doubt with triggers