call a stored procedure with a variable name

Nemetona used Ask the Experts™
I would like to call a stored procedure in one database from another database using a variable for a name.

call dbone.stored_procedure_name works when I use the database name but I would like to call it by setting a variable for the database name.

set mydb='dbone';

call mydb.stored_procedure_name;

Is this possible and if so what is the syntax?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
In the end it was as easy as a Prepared statement

set @query=concat('call ',thedb,'.calculateTCL(',v_email,',''380-1-0002'')');
select @query;
PREPARE stmt1 FROM @query;
 EXECUTE stmt1;

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial