Mysql存储过程查询数据插入别的表里。
时间:2021-07-01 10:21:17
帮助过:4人阅读
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();
Mysql存储过程查询数据插入别的表里。
标签:sel col roo iter from call tin next open