SET @idx = 1; SET @len = LENGTH(temp_accintervals) - LENGTH(REPLACE(temp_accintervals, ',', '')) + 1; WHILE @idx <= @len DO SET accinterval1 = TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(temp_accintervals, ',', @idx), ',', -1)); SELECT accinterval1; /** * 取卷内条目数 */ SELECT count( 1 ) INTO records FROM t_ams_recordother t WHERE t.archivesym = accinterval1 AND FONDSCODE = '2110000' AND bookid = 0 and classno in ('银行余额调节表','银行对账单'); select records ; IF records = 0 then SELECT concat(accinterval1,' - 未查询到需要组卷的数据'); SET @idx = @idx + 1; CONTINUE while; end if; SET @idx = @idx + 1; END WHILE;
时间: 2024-01-26 08:03:38 浏览: 53
定时(setInterval)加载数据
根据你提供的代码,使用 `CONTINUE` 时需要在 `WHILE` 后面加上循环名称,以便让 `CONTINUE` 跳过指定的循环,所以你需要将 `CONTINUE` 语句中的 `while` 改成循环的名称,例如:
```
SET @idx = 1;
SET @len = LENGTH(temp_accintervals) - LENGTH(REPLACE(temp_accintervals, ',', '')) + 1;
WHILE @idx <= @len DO
SET accinterval1 = TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(temp_accintervals, ',', @idx), ',', -1));
SELECT accinterval1;
/** 取卷内条目数 */
SELECT count(1) INTO records FROM t_ams_recordother t WHERE t.archivesym = accinterval1 AND FONDSCODE = '2110000' AND bookid = 0 and classno in ('银行余额调节表','银行对账单');
SELECT records;
IF records = 0 THEN
SELECT concat(accinterval1,' - 未查询到需要组卷的数据');
SET @idx = @idx + 1;
CONTINUE WHILE;
END IF;
SET @idx = @idx + 1;
END WHILE;
```
在上述代码中,`CONTINUE` 语句中的 `while` 被改成了 `WHILE` 循环的名称,以便让 `CONTINUE` 跳过指定的循环。
阅读全文