I have a table like the one below.
CREATE TABLE People(PeopleId INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Name VARCHAR(255), Age INT); INSERT INTO People(Name, Age) VALUES('Sam', 25), ('John', 24), ('Ria', 14), ('Diya', 23), ('Topel',19), ('Mac', 45);
I created a procedure in which I use the temporary age of a variable for some purpose.
DROP PROCEDURE IF EXISTS Sample; CREATE PROCEDURE Sample() BEGIN SELECT @Age = Age FROM People WHERE PeopleId = 4; SELECT * FROM People; END;
Do not ask why I store age in a temporary variable, as the above is not an exact procedure.
When I start the procedure, the temporary variable becomes displayed as one of the result sets along with the result set that I get for the selected query. How can I avoid displaying a temporary variable as part of a result set after assignment?
mysql mysqli stored-procedures prepared-statement
ArrayOutOfBound
source share