Friday, October 4, 2013

Group by not working in oracle

 Have you run into this trouble with grouping in oracle, especially after transferring your database into different system running obviously a different version of oracle ? Be cool.
Oracle introduced a hash-based GROUP BY in 10.2.  Previously, a GROUP BY operation involved sorting the data on the relevent columns, then accumulating aggregate results. 

What does it means ?

before 10.2 : select name , id from table group by id, name => will work

after 10.2 : select name , id from table group by id, name => will  not work
            but select name , id from table group by id, name order by  id, name => will work


To disable the hash-based group by using the following command under a user with sysdba' privilege:

> alter system set "_gby_hash_aggregation_enabled" = FALSE scope=BOTH;

> commit;

No comments:

Post a Comment