DROP temporary TABLE IF EXISTS Temporary_T; create temporary table if not exists Temporary_T(id int );
IF NOT EXISTS :是说如果你的临时表如‘Temporary_T’不存在就创建临时表
alter table Temporary_T add d0 DECIMAL 添加一个字段
USE `jj`; DROP procedure IF EXISTS `Day`; DELIMITER $$ USE `jj`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `Day`(in ID int,in d1 datetime,in d2 datetime) BEGIN DROP temporary TABLE IF EXISTS Temporary_T; create temporary table if not exists Temporary_T(id int ); alter table Temporary_T add d0 DECIMAL; select * from Temporary_T; DROP TEMPORARY TABLE IF EXISTS Temporary_T; END$$ DELIMITER ;