存储过程

1、查看已存在的存储过程内容

show create procedure UpdatePushRecord; 

 

2、添加存储过车

DELIMITER //

CREATE DEFINER=`root`@`%` PROCEDURE `UpdateHspTask`()
begin
INSERT INTO
`hsp_enforcementresult_tasklog` (`Id`, `RelationId`, `Type`, `TreatmentId`, `PatientId`, `PatientCard`, `PatientRegNo`, `PatientName`)
select 'id','-1','Type','TreatmentId','PatientId','PatientCard','PatientRegNo','PatientName'
from hsp_enforcementresult_task
where DATE_FORMAT(now(), '%H:%i:00')='23:55:00' and DATE_FORMAT(CreateTime, '%H:%i:00')!='23:55:00';


delete from `hsp_enforcementresult_task`
where DATE_FORMAT(now(), '%H:%i:00')='23:55:00' and DATE_FORMAT(CreateTime, '%H:%i:00')!='23:55:00';
end //
DELIMITER ;

 

注意: mysql中DELIMITER //的使用

3、删除存储过程

DROP PROCEDURE UpdateHspTask;

 

posted @ 2017-01-04 18:18  桑夏  Views(131)  Comments(0Edit  收藏  举报