Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A doubt with triggers

 
vignesh bala
Greenhorn
Posts: 28
Eclipse IDE Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic