Reputation: 495
Like in procedures and Functions can we pass parameters to triggers? Can A trigger can be explicitly called?
Upvotes: 2
Views: 10709
Reputation: 21
What you can do is to create a table that will store temporarily the data that you want to access in your trigger.
1-Create a table "tmp_data" for instance. 2-Before running the event that will fire the trigger (stored procedure, insert, update...) insert into tmp_data the data that you want to use in the trigger. 3-In the trigger, to access the data you needed, you make a query on the table tmp_data. 4-After have been done with the data, you clean the table tmp_data for the next use.
Hope has been helpful!
Upvotes: 2
Reputation: 101
An object based trigger is raised by an event's occurence(as update,insert,select)on a specific object of the database. There is also system triggers, fired by system specific events(as shutdown,startup database, user connection etc..).
This is the main purpose of a trigger in databases, you can't raise it explicitly, if you want it to run the only way is to raise the event. Also passing parameters isn't part of trigger definition, but you can handle the event attributes,(which can be passed to the trigger body that may can contain functions or procedures).
I hope that i've responded to your question, can i know what is your need for trying to do that.?
Upvotes: 6