I am trying to write my first Stored Procedures from a book I am following, but they don't seem to be working...
From my book, I pasted the following code into phpMySQL...
Stored Procedure:
Code MySQL:--------------------------------------------------- -- -- STORED PROCEDURE: Select Categories -- DELIMITER $$ CREATE PROCEDURE select_categories (type VARCHAR(6)) BEGIN IF type = 'coffee' THEN SELECT * FROM general_coffees ORDER by category; ELSEIF type = 'other' THEN SELECT * FROM non_coffee_categories ORDER by category; END IF; END$$ DELIMITER ;
phpMySQL successfully created the STored Procedure, but when I try to test it using this call...
Code MySQL:--------------------------------------------------- -- -- STORED PROCEDURE: Tests -- CALL select_categories('coffee');
I get the following error...
What is going on??Error
SQL query: Documentation
CALL select_categories(
'coffee'
)
MySQL said: Documentation
#1312 - PROCEDURE mycoffeeshop.select_categories can't return a result set in the given context
Debbie






Bookmarks