DELIMITER// CREATE PROCEDURE setRoomManger2() BEGIN DECLARE roomids VARCHAR(32); DECLARE done INT DEFAULT 0; DECLARE cur CURSOR FOR SELECT roomid FROM nst_t_room; DECLARE CONTINUE HANDLER FOR SQLSTATE ‘02000‘ SET done = 1; OPEN cur; FETCH NEXT FROM cur INTO roomids; REPEAT IF NOT done THEN INSERT INTO nst_t_devaccess(AccountID,ID,TYPE) VALUES(-1,roomids,1); END IF; FETCH NEXT FROM cur INTO roomids; UNTIL done END REPEAT; CLOSE cur; END;
CALL setRoomManger2();
原文地址:https://www.cnblogs.com/penghq/p/10691635.html
时间: 2024-10-18 17:58:06