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 have created a procedure where I use temporary variable age for some purpose.
DROP PROCEDURE IF EXISTS Sample;
CREATE PROCEDURE Sample()
BEGIN
SELECT @Age = Age
FROM People
WHERE PeopleId = 4;
SELECT *
FROM People;
END;
Don’t ask why I am storing age in temporary variable since the above is not the exact procedure.
When I run the procedure, the temporary variable is getting displayed as one of result set along with the result set I get for select query. How can I avoid displaying the temporary variable as part of the result set after assignment?
try this one,
or