--删除
drop procedure if exists up_common_select
--创建
CREATE PROCEDURE `up_common_select`
(
in t_name varchar(50)
)
begin
declare v_sql varchar(500);
set v_sql= concat('select * from ',t_name);
select v_sql;
--注意:prepare(预处理)execute stmt using @var,只能跟@var变量,declare和传入的变量不行!!!
set @v_sql=v_sql;
prepare stmt from @v_sql;
EXECUTE stmt ;
deallocate prepare stmt;
end;
--调用
call up_common_select('admin_...[ 查看全文 ]