1. 程式人生 > >mysql儲存過程使用表名做引數

mysql儲存過程使用表名做引數

use mail;
delimiter $;
drop procedure if exists mlook;
create procedure mlook(in tbl varchar(10))
begin
SET @sqlcmd = concat('select * from ', tbl);
prepare stmt from @sqlcmd;
execute stmt;
deallocate prepare stmt;
end;