• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Triggers

 
Mythri Hegde
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to create a trigger service that deletes some rows, inserted a day before
i have time stamp stored in a column of the row
while inserting a row, if there are foreign key is defined, will it check automatically ?'
I need the code ASAP. Please help me out with this
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your triggering event is that a day has passed since the row was inserted then its not a trigger you want. Triggers are fired by events like update, insert or delete, they are not fired based on time.

It sounds like what you need is a Timer and TimerTask to poll the table daily and remove all those rows whos timestamp is outside your range.


while inserting a row, if there are foreign key is defined, will it check automatically ?'

Not sure you are asking here. Constraints are the domain of the database - it will enforce them.
 
Campbell Ritchie
Sheriff
Posts: 51332
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . or in SQL, an event. The TimerTask sounds easier to implement however.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic