首页 > 代码库 > 存储过程中使用运行查出的SQL

存储过程中使用运行查出的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

 

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