游标 select 中使用的 Table 从编译时重组为 运行 时

Table used in cursor select is restructured from compile-time to run-time

我得到 CALL Failed. [7691] SP_name:Table used in cursor select is restructured from compile-time to run-time.

我相信是因为我在我的存储过程中循环了日期:

If min_mnth <= max_mnth THEN
        LoopMnth:
        FOR cc_mnth AS cc_cdates CURSOR FOR
            SELECT To_Char(calendar.calendar_date, 'yyyy-mm') as mnth
            from sys_calendar.calendar
            where To_Char(calendar.calendar_date, 'yyyy-mm') between min_mnth and max_mnth
            and mnth not in (select report_mnth from tb1)
            and mnth >= '2017-08'
            group by 1 order by 1
.....

有趣的是,这样的过程有时会起作用,大多数时候我的循环迭代次数较少。

我只找到了这个相关信息https://community.teradata.com/t5/Database/Error-7691-P1-Table-used-in-cursor-select-is-restructured-from/td-p/36691

他们建议 SET SESSION DATEFORM = INTEGERDATE - 同样的错误。

此错误是关于什么的以及如何解决?

然后你得到这样的错误,只是

1) SET SESSION DATEFORM = INTEGERDATE
2) Recreate your procedure