If I set a session variable (eg. @tmp = 0), then a query can be run/ignored depending on whether a condition is met.
SET @create_table := IF(@tmp >= 1, 'CREATE TABLE table2 SELECT * FROM table1', 'no');
This is usable for a short query like the example above, but not so for more complex queries with multiple statements. Is it possible to do something like this?
IF(@tmp >= 1)
DO SOMETHING
ELSE
DO NOTHING