If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Execute Store Proc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-11, 10:35
aadil aadil is offline
Registered User
 
Join Date: Nov 2003
Location: Mars
Posts: 115
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
Reply With Quote
  #2 (permalink)  
Old 05-04-11, 13:06
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
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
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On