|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
using dinamic table name inside stored procedure
From: AESYS S.p.A. [Enzo Arlati] (enzo.arlati
aesys.it)
Date: Thu Nov 17 2005 - 06:33:11 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
enzo.arlati
aesys.it
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]