I've got a procedure that uses a loop with a SELECT statement, but the statement is actually just to set a variable. That means there's a lot of stuff being displayed that I don't need to see, and it's flooding my terminal.
Here's an example of what I mean, though this isn't actually what I'm running (because that's company information):
DROP PROCEDURE IF EXISTS test;
CREATE PROCEDURE test()
@dummyString := stringField
SET @dummyStringAll :=CONCAT(@dummyStringAll,$dummyString);
SET @key := @key + 1;
END REPEAT testloop;
Stored procedures will return a query resultset if it isn't stored in a variable.
How does it know that you are storing the result in a variable?
Not be using variables in the query but by using the
SELECT value INTO <variable> syntax in the query. see: 22.214.171.124 SELECT ... INTO Syntax
From the FAQ:
1) Can MySQL 5.6 stored routines return result sets?
Stored procedures can, but stored functions cannot. If you perform an ordinary SELECT inside a stored procedure, the result set is returned directly to the client.
So, using the 'SELECT ... INTO ...' syntax will prevent the procedure returning the resultset from a query.