MySQL Forums
Forum List  »  MySQL Query Browser

How to test a stored procedure with output parameter
Posted by: James MA
Date: September 20, 2008 05:20AM

It seems that the Query Browser does not support DECLARE statements, may I know how we can test a stored procedure with output parameter.

For example, here is a simplified stored_procedure

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_dummy`(OUT a INT)
BEGIN
SET a = 123;
END


I try to write a simple code for testing:

DECLARE x INT;
call sp_dummy(x);
SELECT x;


The following error is reported:

>> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE x INT' at line 1


It seems that the Query Browser cannot handle the DECLARE, I have to write a dummy stored procedure to include the testing script in order to test my stored procedure, it's really stupid.

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_dummy2`()
BEGIN
DECLARE x INT;
call sp_dummy(x);
SELECT x;
END



May I know if there has any tools that can use for testing stored procedures directly?


Thanks in advance!
James

Options: ReplyQuote


Subject
Written By
Posted
How to test a stored procedure with output parameter
September 20, 2008 05:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.