Testing a Stored Procedure

If I have a Stored Procedure like this…


DELIMITER $$
CREATE PROCEDURE select_customer(type VARCHAR(10))
BEGIN
	IF cust_type = 'premium' THEN
		SELECT *
		FROM customers
		WHERE type = 'premium';
	ELSE
		SELECT *
		FROM customers;
	END IF;
END$$
DELIMITER;

Shouldn’t I be able to test the Stored Procedure with a call like this??


CALL select_customer('premium');

I tried that with an example in my book and it gave me an error.

TomTees

and the error was … ?

Error

SQL query: Documentation

CALL select_customer(
‘premium’
)

MySQL said: Documentation
#1312 - PROCEDURE customer_db.select_customer can’t return a result set in the given context

TomTees