存储过程

    CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertUser`(in name2 varchar(50),in password2 varchar(32),in age2 int,in adddate2 datetime) 
    begin 
    DECLARE stmt varchar(2000); 
    set @sqlstr=concat('insert into users(name,password,age,adddate) values('); 
    set @sqlstr=concat(@sqlstr,'''',name2,'''',',','''',password2,'''',',',age2,',','''',adddate2,'''',')'); 
    prepare stmt from @sqlstr; 
    execute stmt; 
    end;

你可能感兴趣的:(存储过程)