Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Usage of SELECT INTO in Before Insert trigger

 
Ahsan Bagwan
Ranch Hand
Posts: 254
1
Java MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a trigger with some business logic in it. I want to compare some old value from the table and insert according to some condition.

But I am not sure SELECT INTO works good as I have searched extensively on the web. There is no handler it seems in trigger that is allowed.

I know I have not tried and checked the result myself. But would like to hear your inputs if you have used SELECT statements in a trigger. Is what I am doing is likely to find a solution to my problem?

I have the trigger till now which goes like:

 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which database are you using? The exact implementation will heavily depend upon that.

I don't think SELECT INTO will come into play at all. The values of modified rows are generally passed into the trigger as parameters - otherwise you wouldn't know how to find the row that is being modified. This might be the reason why your search came up empty. Searching for <your database> before trigger might give much more relevant result.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic