Phpmyadmin launches mysql stored procedure but does not output

I am writing a very simple stored procedure as shown below:

DROP PROCEDURE IF EXISTS GetAllTours; DELIMITER // CREATE PROCEDURE GetAllTours() BEGIN SELECT * FROM tours; END // DELIMITER ; 

When i use

 CALL GetAllTours(); 

there is no way out of the SQL query to run this procedure.

But if I exit >>Routines>>Execute , of the same procedure, the output will be successfully executed.

Can someone tell me how to run from a SQL query and get the results?

+6
source share
2 answers

You can simply use this query: CALL GetAllTours

+1
source

First of all, I think you're trying to create a view. Have a look here: http://dev.mysql.com/doc/refman/5.0/en/create-view.html

 mysql> CREATE VIEW GetAllActiveTours AS SELECT * FROM tours where active=1; mysql> select * from GetAllActiveTours; 

To return data from the procedure, use the OUT parameter. http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

example from the link above:

 mysql> CREATE PROCEDURE simpleproc (OUT param1 INT) -> BEGIN -> SELECT COUNT(*) INTO param1 FROM t; -> END// mysql> CALL simpleproc(@a); mysql> SELECT @a; 
-1
source

All Articles