mysql 存储过程
DROP PROCEDURE IF EXISTS sp_name; create procedure sp_name() BEGIN DECLARE suozaizhuji VARCHAR(32); DECLARE base_ip VARCHAR(32); DECLARE s int DEFAULT 0; DECLARE baseip CURSOR FOR SELECT ip from base ; DECLARE CONTINUE HANDLER FOR NOT FOUND SET s=1; OPEN baseip; FETCH baseip INTO base_ip; while s <> 1 DO select `所在主机` into suozaizhuji from VM where `IP地址` like CONCAT('%',base_ip,'%'); UPDATE base set `物理服务器名`= suozaizhuji where IP=base_ip; FETCH baseip INTO base_ip; end WHILE; CLOSE baseip; END
休对故人思故国 且将新火试新茶 诗酒趁年华