Hi!
When using prepared statements inside stored procedures, should they be deallocated at the end of the procedure or not, or does it not matter, and why?
Some code to explain:
CREATE PROCEDURE getCompanyByName (IN name VARCHAR(100))
NOT DETERMINISTIC
BEGIN
PREPARE gcbnStatement FROM 'SELECT * FROM Companies WHERE name=? LIMIT 1';
SET @companyName = name;
EXECUTE gcbnStatement USING @companyName;
DEALLOCATE PREPARE gcbnStatement;
END $$
So - should the DEALLOCATE statement be there or not? Cheers!
/Victor