mysql函数执行

mysql函数执行的实例

CREATE DEFINER=`root`@`%` PROCEDURE `TrancateDay`()
begin
	set @Sql1 := "truncate summary_day";

  SET @Sql2 = "insert into summary_day (service) (select service from summary_minute GROUP BY service) ";
	
	prepare stmt from @Sql1;
	EXECUTE stmt;
	deallocate prepare stmt;

	prepare stmt from @Sql2;
	EXECUTE stmt;
	deallocate prepare stmt;
end

你可能感兴趣的:(MySQL,函数模板)