Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Mars
    Posts
    115

    Unanswered: Execute Store Proc

    Hello All :

    I m new bee to Mysql. Pls let me know how to execute store proc in mysql.
    Below is the code, getting error while creating the proc as-well
    -----
    CREATE procedure mydb.SP_Delete_multiple_Account_Id (@account_id int, @myResult varchar(32))
    DECLARE accountid CURSOR FOR
    SELECT account_id
    FROM mydb.account_id_number
    ORDER BY account_id;
    OPEN accountid;
    FETCH NEXT FROM accountid
    into @account_id;
    WHILE @@FETCH_STATUS = 0
    BEGIN

    SET @myResult = CALL `mydb`.`Sp_Delete_Accountid`("@account_id");
    Exec @myresult;

    FETCH NEXT FROM accountid
    into @account_id
    END
    CLOSE accountid;
    DEALLOCATE accountid;
    GO
    -----


    Thanks in Advance
    Adil

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Make sure you set your DELIMITER GO (I am suggesting GO as you have GO at the end of your stored procedure creation but this could be anything) in MySQL before attempting to create the stored procedure. By default the semicolor ";" will automatically execute the code which will fail because you have not reached the bottom of your stored procedure.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •