mysql存储过程带入变量(非in)

注意分号结束
create PROCEDURE test()
begin
declare sqll varchar(500);
declare id int;
set id=1376;
set sqll=concat("select * from oepp007m where id= ",id);
set @sql=sqll;
PREPARE stmt from @sql;
execute stmt;
end;
call test();

猜你喜欢

转载自www.cnblogs.com/liyunchuan/p/11670909.html
今日推荐