MySQL存储过程中的动态SQL
更新:HHH   时间:2023-1-7


MySQL版本5.0.13以上

create table aa (id int);

delimiter //

create procedure test(v_sql varchar(200))
begin
set @sqltext:=concat('insert into aa ',v_sql);
prepare stmt from @sqltext;
execute stmt;

DEALLOCATE PREPARE stmt;
end;
//

call test('values (1)')//

[@more@]
返回MySQL数据库教程...