Consider the following procedure:
CREATE PROCEDURE `getFoo`()
BEGIN
select 'bar' as foo;
END;
Once call
-ed, it outputs:
{"foo":"bar"}
But what if getFoo
is invoked within a different stored procedure, how do I catch its result content into a variable, like this?
CREATE PROCEDURE `masterProc`()
BEGIN
call `getFoo`() into @foo;
select @foo as foo;
END;
This outputs the following error when invoked: sqlMessage: "FUNCTION db.getFoo does not exist"
I am aware of the available options involving out
parameters, but those are not viable resolution(s) to my problem.
Obligation(s)
getFoo
cannot be altered. It will output the results of a SELECT
statement without involving any variables
nor parameters
.
What I've tried
Unfortunately, all will output errors.
set @foo = exec getFoo();
set @foo = call getFoo();
select getFoo() into @foo;
call getFoo() into @foo;