You can convert your empata , pierde and gana pierde into functions and use them as encoded in the first example below:
I tested the following scripts and they did not work:
-- won't work SET @st = 'loc'; IF @st = 'loc' THEN function_(@st); END IF; -- won't work SET @st = 'loc'; SELECT CASE @st WHEN 'loc' THEN CALL stored_procedure_(@st) END INTO @dat; SELECT @dat; -- won't work SET @st = 'loc'; IF @st = 'loc' THEN CALL stored_procedure_(@st); END IF;
At least none of the three above instances worked for me. You can try them and see which one works for you.
Also, your question here is the same as: MYSQL Calling stored procedures inside a SELECT CASE on a trigger . Also you sent. Iβm not sure which of the moderators will be closed or saved, so I am sending this answer too. If, another time, you would like to follow up on a question that you were asked that didnβt get an answer acceptable to you, just jump so people can see it again.
source share