我在simple_loop上收到语法错误:循环语句说
Unexpected character near ':'
行simple_loop:LOOP
请帮忙
DELIMITER $$
CREATE PROCEDURE getTable(fullstr VARCHAR(555))
BEGIN
DECLARE a INT Default 0
DECLARE str VARCHAR(255)
simple_loop: LOOP
SET a=a+1
SET str=SPLIT_STR(fullstr,",",a)
IF str='' THEN
LEAVE simple_loop
END IF
#Do Inserts into temp table here with str going into the row
insert into my_temp_table values (str)
END LOOP simple_loop
END $$
答案 0 :(得分:1)
这是一个非常烦人的MySQL语法相关问题:在您的过程中有一个TAB导致此解析问题。
注意:单独;
DELIMITER $$
CREATE PROCEDURE getTable(fullstr VARCHAR(555))
BEGIN
DECLARE a INT Default 0 ;
DECLARE str VARCHAR(255);
simple_loop: LOOP
SET a=a+1;
SET str=SPLIT_STR(fullstr,",",a);
IF str='' THEN
LEAVE simple_loop;
END IF;
#Do Inserts into temp table here with str going into the row
insert into my_temp_table values (str);
END LOOP simple_loop;
END $$