Help with Stored Procedures

I am trying to write my first Stored Procedures from a book I am following, but they don’t seem to be working… :frowning:

From my book, I pasted the following code into phpMySQL…

Stored Procedure:


---------------------------------------------------
--
-- 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…


---------------------------------------------------
--
-- STORED PROCEDURE: Tests
--
CALL select_categories('coffee');

I get the following error…

[COLOR=“Red”]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
[/COLOR]

What is going on?? :-/

Debbie