Reputation: 133
I have created the following stored procedure for MySql schema on sqlfiddle
create procedure foobar(out msg int)
begin
set msg = 100;
end//
When i run the query to access the out parameter using
call foobar(@outval);
SELECT @outval;
I get the following error
ResultSet is from UPDATE. No Data.
I am not sure what am i doing wrong. Please suggest.
I am taking this as reference MySQL create stored procedure syntax with delimiter
Sql fiddle link: http://sqlfiddle.com/#!9/a2182/6
Upvotes: 0
Views: 4597
Reputation: 44844
You are missing the delimiter
at the start, so it should be as
delimiter //
create procedure foobar(out msg int)
begin
set msg = 100;
end;//
delimiter ;
Here is a test case in mysql cli
mysql> delimiter //
mysql> create procedure foobar(out msg int)
-> begin
-> set msg = 100;
-> end;//
Query OK, 0 rows affected (0.05 sec)
mysql> delimiter ;
mysql> call foobar(@outval);
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT @outval;
+---------+
| @outval |
+---------+
| 100 |
+---------+
1 row in set (0.01 sec)
Upvotes: 3