Hi , 

in oracle 10 g , the below query results in alphabetical order , there is no order by caluse. but when i am running the same query in oracle 11g , it gives me in random order. what is the problem here?

select distinct  Report_137__1_ . COUNTRY_NM   COUNTRY_NM  from (select distinct  v . CTMS_TRIAL_ALIAS_CODE ,  v . CLINICAL_TRIAL_ID ,  c . GEO_BOUNDARY_ID ,  c . COUNTRY_NM ,  c . CANCEL_INDC ,  c . STOP_INDC  from  CTMS_CLINICAL_TRIAL_ID_V   v ,  TRIAL_COUNTRY_V   c  where  v . CLINICAL_TRIAL_ID = c . CLINICAL_TRIAL_ID )  Report_137__1_


above is a  simple select statement. Thanks much.

Tags: PL/Sql, by, clause, order

Views: 273

Reply to This

Replies to This Discussion

The problem is simple: The query does not have an ORDER BY clause.

If you want Oracle to guarantee a specific order of a result set *every time you run a query* you have to use an ORDER BY.

But does this means in 10g we do not need to mention order by clause and still we get the result in alphabetical order i.e. ascending order.i understand that we need to mention order by clause to get the result in asc/desc order.

but why here in 10g i am getting the result in asc order without mentioning the order by clause and in 11g m not.

does 10g ,11g have diff in sorting the result set?


This means that the query's optimizer plan in 11g is not the same as 10g.

I suggest you read this blog post by Tom Kyte: http://tkyte.blogspot.com/2005/08/order-in-court.html

Thanks a lot , this does help. hope i would be able to make business user understand this ;) 


Oracle Community On

I'm not a fan of advertising, and so I will not be including any advertisements on OracleCommunity.net. However, managing this community does not come without cost! If you are willing to donate to help pay for the monthly community fees and domain services I accept Bitcoin and PayPal donations.

Donate Bitcoins



Blog Posts

Join and Union examples of related tables to show different SQL and esProc syntax

Join multiple tables with “join”

The SQL…


Posted by Jim King on October 15, 2014 at 12:02am

profiles in Oracle DBA

I've one question it is related to Oracle DBA, I've just read about password settings in profiles concept, i'm little bit confusing on PASSWORD_REUSE_MAX and PASSWORD_REUSE_TIME, and I understand something about these two topics. I updating here what i'm understand when I was reading about this, so tell me is it right or wrong.

1) PASSWORD_REUSE_MAX: This setting is used for reusing of old passwords. The functionality of this setting is restricts reusing of old password for…


Posted by Bhagya Raj Katta on October 10, 2014 at 7:21am

Dynamic Performance views-what are they?

A little bit about how exactly Oracle retrieves the information from Dynamic performance views. Read more here : http://suntrupth.blogspot.in/2014/10/dynamic-performance-views-what-are-they.html

Posted by Suntrupth Yadav on October 9, 2014 at 9:30am

Oracle Masters?

Where can I ask my Oracle / PlSQL related doubts from masters ?

Posted by Mohammed on September 24, 2014 at 6:07pm

© 2014   Created by Steve Karam.

Badges  |  Report an Issue  |  Terms of Service