How to disable output for mysql EXECUTE command in workbench

I am trying to use a prepared statement in mysql workbench in a cursor. The cursor works with a very large dataset, so it runs many times. Each time a new result is displayed in the EXECUTE step. This causes the mysql workbench to crash due to too many open result windows.

In the cursor, I am doing something like this:

PREPARE stmt2 FROM @eveningQuery; EXECUTE stmt2; DEALLOCATE PREPARE stmt2; 

I usually use things like

 set aVar = (EXECUTE stmt2); 

to turn off the request, but EXECUTE does not work.

Does anyone know how you can disable output for EXECUTE command in mysql?

Note. I understand how I can get data in a variable, however, what I want to prevent is that it appears in a result overview like this enter image description here

This will crash when loading mysql-workbench with too many cycles.

because he was given the @eveningQuery example.

SET @eveningQuery = CONCAT ('select @resultNm: = exists (select idSplitBill from tb_SplitDay, where idSplitBill =', idSplitBillVar, 'and', @columnNameEv, '= 1 and softdelete = 0)');

idSplitBillVar = identifier coming from the cursor. @columnNameEv = column that I am filling in a variable.

I added this information because it was asked, but in my opinion it does not matter much, because the question still stands even with the simplest request. When you execute a prepared statement, you will get the result. I just want to disable this behavior.

+6
source share
1 answer

The query you use creates a new result set, and the GUI client displays it (... many times) -

 SELECT @resultNm:=EXISTS( SELECT idSplitBill FROM tb_SplitDay WHERE idSplitBill =', idSplitBillVar, ' AND ', @columnNameEv ,' = 1 AND softdelete = 0 ) 

You can rewrite this query and the result set will not be created -

 SELECT EXISTS( SELECT idSplitBill FROM tb_SplitDay WHERE idSplitBill =', idSplitBillVar, ' AND ', @columnNameEv ,' = 1 AND softdelete = 0 ) INTO @resultNm 
+6
source

All Articles