Hello.


Have a look here:

  http://dev.mysql.com/tech-resources/articles/mysql-storedproc.html



For a pity prepared statements are disabled now in stored routines:

  http://dev.mysql.com/doc/refman/5.0/en/routine-restrictions.html







AESYS S.p.A. [Enzo Arlati] wrote:

> I need to pass to a stored procedure a var a table name.

> But I don't known how use the variable in the sql statement.

> If I use the method described belowe I get an error, the procedure use the

> variable name as the name of the table.

> Someone can help ?

> 

> CREATE FUNCTION `myFunc`( tbl_name varchar(100)) RETURNS int(11)

> BEGIN

>   declare dt1 timestamp default 0;

>   select max(dt_mod) into dt1 from tbl_name;

> 

> END $$

> 

> 

> select myFunc( 'pmv_status' );

> Error Code : 1146

> Table 'pmv_manager.tbl_name' doesn't exist

> (0 ms taken)

> 

> Regards,

> Enzo Arlati

> [EMAIL PROTECTED]

> 

> 

> 

> 

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to