简体   繁体   English

Oracle Weird错误:意外错误ORA-00937:不是单个组组功能

[英]Oracle Weird error : Unexpected error ORA-00937: not a single-group group function

Oracle Weird error : Unexpected error ORA-00937: not a single-group group function Oracle Weird错误:意外错误ORA-00937:不是单个组组功能

Executing from VB6 Application, using Adodb using Provider=MSDAORA.1 使用Provider = MSDAORA.1使用Adodb从VB6应用程序执行

Query: 查询:

Select Max(SNO) as SRNO 
  From Orders 
 Where OrderDate = '30-Jan-2009' 

Error: 错误:

Unexpected error ORA-00937: not a single-group group function 意外错误ORA-00937:不是单组分组功能

As per my knowledge this error should be fired only if the query contains an aggregate function, while the selected columns not in the aggregate function, then these columns must be in the Group By clause. 据我所知,仅当查询包含聚合函数时才会触发此错误,而所选列不在聚合函数中,则这些列必须位于Group By子句中。

Now in my query, there is no extra column selected. 现在在我的查询中,没有选择额外的列。

More weird: 更奇怪:

If the same query is executed in the oracle SQL Plus it works. 如果在oracle SQL Plus中执行相同的查询,则该查询有效。 But gives above error if executed from VB6. 但是,如果从VB6执行,则会出现上述错误。 Any hints 任何提示

I have worked around MAX using rownum and inner query. 我已经使用rownum和内部查询解决了MAX

select SRNO  
  from (Select SNO as SRNO 
          From Orders 
         Where OrderDate = '08/Dec/2009'  
      order by SNO  desc ) 
 where RowNum = 1 

Could be bug 1988231 if you have CURSOR_SHARING set to FORCE or SIMILAR , which is a problem with the Microsoft drivers and databases up to 10.2.0.4. 可能是错误1988231,如果您有CURSOR_SHARING设置为FORCESIMILAR ,这与微软的驱动程序问题,数据库保持10.2.0.4。 Advice seems to be to set CURSOR_SHARING to EXACT (the default I think), or switch to use an Oracle ODBC driver. 建议似乎是将CURSOR_SHARING设置为EXACT (我认为是默认值),或者切换为使用Oracle ODBC驱动程序。

(The bug itself is closed as not-a-bug (since it's a Microsoft issue not an Oracle one), and it's referenced from Metalink document ID 462734.1). (该错误本身作为非错误而关闭(因为它是Microsoft问题而不是Oracle问题),并且从Metalink文档ID 462734.1引用了该错误)。

如果将提供程序更改为OraOLEDB.Oracle,则它看起来像是ADO提供程序中的错误-这样查询就可以了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM