存储过程中使用运行查出的SQL

BEGIN
 declare u_name varchar(100);
 declare s_name varchar(100);
  set u_name=‘update ‘;
 set s_name=concat(‘ set cur_status =‘,‘90‘);
 set @u_table=CONCAT(u_name,t_name,s_name);
 select @sql_info :=sql_info from sql_info where code=code_info;
 PREPARE pre_sql from @sql_info;
 PREPARE pre_u from @u_table;
 EXECUTE pre_sql;
 EXECUTE pre_u;
 deallocate prepare pre_sql;
 deallocate prepare pre_u;
 update sql_info set use_time=UNIX_TIMESTAMP(NOW()) where code=code_info;
 update calculate_data  Set  cur_status = ‘39‘ Where  item = item_code;
 
end

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。