【问题标题】:Table used in cursor select is restructured from compile-time to run-time游标选择中使用的表从编译时重组为运行时
【发布时间】:2018-12-07 12:44:43
【问题描述】:

我收到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 - 同样的错误。

这个错误是关于什么以及如何解决它?

【问题讨论】:

  • 我对这个不感兴趣,但只是想再次检查您是否运行了 SET SESSION DATEFORM = INTEGERDATE,然后编译了该过程(不是运行,而是编译)。然后在那之后尝试运行。我想您做到了,这是一个“您是否再次打开和关闭计算机”类型的问题,但您的问题中没有说明。
  • 另外,老实说,我觉得这是进入“错误”领域,所以如果你在这里没有得到任何牵引力,我会把它扔到 Teradata 论坛上,说明你已经采取的步骤和让其中一个人把手放在 teradata 的位和字节中潜入其中。 (除非@dnoeth 已经把它搞砸了,因为他是个疯狂的邪恶聪明人,并且像那样连接)。
  • 猜猜看,@JNevill,?)我用那个选项重新编译了 proc - 现在看起来工作正常,但无论如何这是一个非常奇怪的问题

标签: sql stored-procedures runtime-error teradata


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2017-04-10
    • 1970-01-01
    • 2023-03-03
    • 2020-02-25
    • 1970-01-01
    • 2016-10-06
    • 2010-11-24
    • 2011-01-22
    • 2017-06-29
    相关资源
    最近更新 更多