How would i go about passing a varibale from a stored procedure to a trigger. I want to pass a stock code from a make order stored proc to a trigger which will check that stock code quantity against its reorder level and fire if its below
You cannot pass a variable from a stored procedure to a trigger. Triggers operate onthe table level and are fired even when someone changes the table manually through Enterprise Manager or witha SQL statement from a user interface or Query Analyser ora a stored procedure. Thus it makes sense mnot to try to get a value from a stored procedure into a trigger or it will not always work. If you need the value to do the trigger processing, you need to add a field to the table and store it. YOu can run a stored procedure from within a trigger, but someother process would have to trigger the trigger first, so you still would not be passing the value from your insert or update or delete stored procedure. Suggest you need to truly evaluate the process by which you want the processing to occur and decide then if you should add a field and poopulate it from the calling stored procedure or handle all the processing in a stored procedure or call a separate stored procedure from the trigger. Just be sure that you think about how your process will affect data integrity if an alternate method of affecting the table is used.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.