Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is trigger ?

 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, good day, what is trigger and how to implement it in java environment, when should we use it ? thank you
 
todd runstein
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A trigger (in databases anyway) are fired when something happens in the database. For example, you can add a trigger when someone updates a record in a table - perhaps it checks to ensure that the record is less than 2 weeks old, or the trigger should make the update fail.

You set the trigger in the database - affecting the database from Java will fire the trigger (by the database). The nice thing about triggers is that they will fire regardless of how you're affecting the database (from Java, from Perl, from a command line utility, etc).

Hope that helps. If it doesn't, tell us more about what you're trying do, why you're asking, or in what context you're using the term "trigger".
 
Sripathi Krishnamurthy
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nakata kokuyo:
hi, good day, what is trigger and how to implement it in java environment, when should we use it ? thank you


In simple terms, trigger is a implicit procedure that gets executed when an insert, update or delete is done on a table/view.
A trigger can be executed before or after the insert, update or delete statement gets executed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic