List:General Discussion« Previous MessageNext Message »
From:hsv Date:April 17 2013 8:09pm
Subject:Re: Doubt with stored procedures
View as plain text  
>>>> 2013/04/17 14:16 +0200, Antonio FernI have a doubt with stored procedures functionality. Is possible that a
stored procedure works with all databases form the server? I have created a
stored procedure on dataBaseA and also works with dataBaseB. Is that
correct? Independently of the user privileges defined. 
It is the default assumption that a procedure within a database is meant for use within
that database, but one can call a procedure from any of the set of databases by qualifying
the name--and the MySQL command "show procedure status" shows all procedures. The only
question is the procedure s use of variables: if they refer only to the arguments, it is
of no importance whence it is called. This is documented:

statements within stored routines are not permitted. When a routine is invoked, an
implicit USE db_name is performed (and undone when the routine terminates). The causes the
routine to have the given default database while it executes. References to objects in
databases other than the routine default database should be qualified with the appropriate
database name. 

Doubt with stored proceduresAntonio Fernández Pérez17 Apr
  • Re: Doubt with stored proceduresJohan De Meersman17 Apr
    • Re: Doubt with stored proceduresAntonio Fernández Pérez17 Apr
  • Re: Doubt with stored procedureshsv17 Apr