Passing parameter to a Trigger

Posted on 2008-11-16
Last Modified: 2012-05-05
Can I pass parameters to a Trigger?
Question by:rpkhare
    LVL 142

    Assisted Solution

    by:Guy Hengel [angelIII / a3]
    "no", as you do not call a trigger. a trigger has only the data available for which rows have been updated/deleted/inserted, and all the data in the tables.

    what are you trying to achieve?
    LVL 8

    Author Comment

    Actually I want to update an old record in a table in which a new record is inserted. From your answer it seems that I'll have to write a Stored Procedure.
    LVL 26

    Expert Comment

    I'm agree with Angelll on can't pass parameter directlyto triggers bcoz you do not call a trigger.

    But how about calling a stored procedure inside a trigger and availing the required parameter???

    Inside trigger you call a sp like this..

    call uNeedParameter(OUT param1);


    call uNeedParameter(@param1);

    Later you can use ' param1' in the body of trigger?

    Does it make sense?

    LVL 8

    Author Comment

    Will it be an overhead or not? What is the advantage of calling a Stored Procedure from a trigger?
    LVL 26

    Accepted Solution


    Personally I feel like trigger itself is a overhead.. and calling a SP inside is adding some more sugar...
    Coming to advantage... just take your example you wanted to pass parameter to trigger but trigger can't be directly what you do a sp inside a trigger and use the parameter..

    LVL 8

    Author Closing Comment


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (…
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now