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).
it looks like a bug in ADO provider, if you change provider to OraOLEDB.Oracle - than query should work
精彩评论