【问题标题】:AS400 rpgle embedded sql using sensitive cursor with over()AS400 rpgle 嵌入式 sql 使用带有 over() 的敏感游标
【发布时间】:2019-10-01 22:29:41
【问题描述】:

语言:RPGLE

  exec sql
    declare    c1_RC0113_PLP04
    sensitive
    scroll
    cursor for
    select     ROW_NUMBER() over ( order by A4KQTT ) as rownbr,
               A4KQTT,
               A4SCAC,
               '0',
               ' '
    from       PLP04
    where      A4KQTT >= :#SCACDESC
    and        A4A8TA  = 'A'
    and        A4KQTT  > ' '
    order by   A4KQTT;
SQL Error:
 Message ID . . . . . . :   SQL0243       Severity . . . . . . . :   30        
 Message type . . . . . :   Diagnostic                                         
 Date sent  . . . . . . :   10/01/19      Time sent  . . . . . . :   16:55:33  

 Message . . . . :   SENSITIVE cursor C1_RC0113_PLP04 cannot be defined for the
   specified SELECT statement.                                                 
 Cause . . . . . :   The cursor C1_RC0113_PLP04 is defined as SENSITIVE but the
   query requires the creation of a temporary result table.  If the SELECT     
   statement has a data change table reference, it requires a temporary result 
   table.  A SENSITIVE cursor cannot be implemented.                           
 Recovery  . . . :   Redefine the cursor as ASENSITIVE or INSENSITIVE or change
   the query so that it no longer requires the creation of a temporary result  
   table.                                                                      

我假设我因为 over() 而收到错误?

我使用敏感的原因是如果发生插入/更新文件,我想显示它们。

提前致谢。

【问题讨论】:

    标签: sql db2 ibm-midrange rpgle cursor-position


    【解决方案1】:

    是的。
    游标必须具体化以计算每一行的此类 OLAP 函数的结果。这就是为什么您不能将其定义为敏感的原因。

    【讨论】:

    • 马克,我确实删除了 OLAP,然后打开时没有发生错误,但后来我失去了 OLAP 给我的功能。底线,对于我的程序,我需要 OLAP 功能,所以我不能使光标敏感。
    • 如果您的光标是只进的,您可能会在不使用 OLAP 函数的情况下枚举应用程序中结果集中的行。如果游标不是只向前的,那么这样的枚举就没有意义了——你可能不得不在每次来回滚动时重新枚举行,并且新的行会出现/消失在游标中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-12
    • 1970-01-01
    • 2021-11-25
    相关资源
    最近更新 更多