Calling Existing Stored Procs

(3 posts) (2 voices)

Tags:

No tags yet.

  1. SteveCC, Member

    Hi, I've added a new report, but the results I want to present to the user are generated by another existing Stored Procedure, which exists outside myDBR.

    I did do a search, but found loads of unrelated matches, so thought it may be quicker just to ask.

    My report SP is below, but when I try and review the report I get the following error:

    "PROCEDURE mydbr.sp_schStockDemandReport does not exist"

    myDBR appears to be prefixing the SP call with mydbr. - why does it do this and how can I stop it?

    Report SP:

    DROP PROCEDURE IF EXISTS sp_DBR_sch_stock_level_forecast $$ CREATE PROCEDURE `sp_DBR_sch_stock_level_forecast`(IN inNumMonths INTEGER) BEGIN

    select 'dbr.pageview'; select 'dbr.title', 'Stock Forecast Report '; select 'dbr.subtitle', CONCAT('Covering the past ',inNumMonths,' months');

    CALL sp_schStockDemandReport(inNumMonths); END $$

    I am new to myDBR, but not new to mySQL (although my Stored Proc experience is a little rusty!)

  2. myDBR Team, Key Master

    Steve,
    yes, you use all database features with myDBR, includeing calling procedures. In fact, if you have larger/more complex system, reusing existing procedures / functions is recommended.

    Your syntax is correct, just check what is the database the procedure is in and that myDBR user has been granted execute rights to it.

    If your procedure is in another database just add the database reference to the call:

    call mydatabase.sp_schStockDemandReport(inNumMonths);

    --
    myDBR Team

  3. SteveCC, Member

    Sorry, I had a brain fade moment and added it to the wrong schema! d'oh.

    I'm only 4 days into a new job, that's my excuse! ;)

    Thanks for the ultra quick response, its appreciated.


Reply

You must log in to post.