How to suppress mysql stored procedure output?

therefore, if I have a stored procedure that contains a selection, how do I suppress the results of these samples by appearing?

for example if i have

create procedure xyz begin select * from table_name #I don't want this to be seen in the console. do other stuff end; 
+5
source share
2 answers

You can set the required parameters to type variables

SET @foo = (SELECT foo_coloumn FROM foo_table);

This will suppress the selection result set.

+7
source

The accepted answer did not work for me, as the result set was multirow. I figured out a solution:

 CREATE TEMPORARY TABLE silence_output SELECT * FROM foo; DROP TEMPORARY TABLE silence_output; 

This avoids the multi-line / multi-column problems that may occur when a result set is dropped into a table, which is then reset. Hope this helps someone else. You can call the temporary table something.

+1
source

Source: https://habr.com/ru/post/1212534/


All Articles