SQLは保存中にラベルを使用します.
1617 ワード
ラベルを使用して、forループと似たような操作を実現します.
BEGIN
DECLARE t VARCHAR(200);
DECLARE t1 int ;
DECLARE ls_cursor CURSOR FOR SELECT name FROM user;
# ,
DECLARE CONTINUE HANDLER FOR NOT FOUND SET t1=1;
SET t1=0;
#
OPEN ls_cursor;
FETCH next FROM ls_cursor into t;
WHILE (t1=0) DO
#
SELECT t as ;
FETCH next FROM ls_cursor into t;
END WHILE;
#
CLOSE ls_cursor;
END