DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`proc_end`() BEGIN UPDATE stat SET `end` = util.VN_NOW() WHERE id = (SELECT id FROM lastid); DROP TEMPORARY TABLE IF EXISTS lastid; END$$ DELIMITER ;