Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

testing stored procedure

I've written a mysql procedure that I am trying to run/test in a query analyzer and obtain the return value. The client is aqua data studio on windows.

In my mind, the code would be something like (i'm new to mysql):

call proc_myproc(@return,1);
select @test;

The intention is that the contents of @test would be shown in the results pane. However, running this returns the error:

 W (1): 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 ';
select @test' at line 1

How can I run more than 1 command in a single request like this? Can I do it outside of a procedure or function? Both lines evaluate/run fine in isolation.
0
pat333
Asked:
pat333
1 Solution
 
racekCommented:
start with

CREATE PROCEDURE myprc (OUT return int)
BEGIN
....
END

then
CALL ..

se: http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now