mysql stored procedure into a variable (non-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();

Guess you like

Origin www.cnblogs.com/liyunchuan/p/11670909.html