Reputation: 1107
I have created few stored procedures in MySql, using the commands
CREATE PROCEDURE sample()
BEGIN
SELECT * FROM members;
END //
But when i want to cal a stored procedure in my phpMyAdmin or using php i am not getting the result.Commands i used
CALL sample;
and also
CALL sample();
When i use he above query no output is shown instead page is redirected to phpMyAdmin home page . Do i need to make any changes in phpMyAdmin???
Upvotes: 1
Views: 537
Reputation: 30488
use ()
for calling stored procedure
CALL sample();
http://forums.mysql.com/read.php?98,358569
you missed the DELIMITER
DELIMITER //
CREATE PROCEDURE sample()
BEGIN
SELECT * FROM members;
END //
DELIMITER ;
Upvotes: 2
Reputation: 2887
Your stored procedure is most probably not being created.
You must include the DELIMITER
command to tell MySQL to ignore the ;
in your command:
DELIMITER //
CREATE PROCEDURE sample()
BEGIN
SELECT * FROM members;
END//
DELIMITER ;
That tells MySQL to use a different delimiter (//
in this case) and restore it (the standard ;
delimiter) at the end of the query.
Then, check your procedure exists with SHOW PROCEDURE STATUS
.
As far as I know, you shouldn't need the brackets ()
to call a procedure that doesn't require any arguments.
Hope that helps.
Upvotes: 1