简体   繁体   中英

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

Executing from VB6 Application, using Adodb using Provider=MSDAORA.1

Query:

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

Error:

Unexpected error ORA-00937: not a single-group group function

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.

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. But gives above error if executed from VB6. Any hints

I have worked around MAX using rownum and inner query.

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. Advice seems to be to set CURSOR_SHARING to EXACT (the default I think), or switch to use an Oracle ODBC driver.

(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).

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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