Can I import Mysql function and use it for multiple database with same pattern name without import that function any more ?
I know Mysql save function in two table :
information_schema.ROUTINES
and mysql.proc
Does anyone have an idea to do this?
Can I import Mysql function and use it for multiple database with same pattern name without import that function any more ?
I know Mysql save function in two table :
information_schema.ROUTINES
and mysql.proc
Does anyone have an idea to do this?
Every stored procedure is associated with its
schema
ordatabase
.So long as the SPs are just routines but not depended on table data, one can happily call them from anywhere.
And if the SPs are intended to calculate based on table data, then you definitely need that
database
qualifier while defining the SP body.I.e. instead of calling
select count(*) from routines;
,you require to call
select count(*) from information_schema.routines;
.If you look into the table structure of both
routines
andproc
you can find a columnroutine_schema
anddb
respectively which point to target database of the SPs.Unless you define SP bodies, which are table data related, in this way you definitely have to redefine them in your database environment.
More important thing is that, you again require privileges to access and execute such cross database SPs.