• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ORA-00979: not a GROUP BY expression

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Getting this error when i run a JPA query on a view , the query is as follows
SELECT t0.qcd, t0.qcnt, t0.qdsc, t0.qsum FROM viewname t0 WHERE ROWNUM <= 20 GROUP BY t0.qcnt, t0.qdsc, t0.qsum, t0.qcd

actually the query runs fine in SQL developer but fails in JPA entity
 
Ranch Hand
Posts: 144
Oracle Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens if you remove the table reference from the column names in the group by clause?
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the purpose of group by if there is no aggregate function in your select statement? If we replace "viewname" with a table this query will not fail. Can you provide a real sql statement? I suppose there is something within "viewname" (view?)
 
Ketan Abdar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no,
i have written a named query in my JPA entity and the query is 'Select o from VStatus o', here Vstatus is the entity in JPA and in DB it is referring a view.
i have tried different forms of query given in previous post to get rid of the error but it always throws this error in logs and the list doesn't get populated,
The view has values in the database, so i dont think there is a problem in the view
 
Mike Zal
Ranch Hand
Posts: 144
Oracle Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't done decent SQL in a while. After looking at Fatih's post I think I might see yhe problem. If you are doing a simple select with no aggregate function, you should be doing an ORDER BY instead of GROUP BY.
 
reply
    Bookmark Topic Watch Topic
  • New Topic