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.

Views: 474

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 ;) 

RSS

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

Badge

Loading…

Blog Posts

List Building: Reach Out to the Target Audience and Boost Your Marketing Efforts

An accurate, relevant and up-to-date database is the bedrock of a successful email marketing campaign. So it is crucial to create and maintain correct and updated mailing lists that help in reaching out to potential customers and converting them into buyers, thereby generating…

Continue

Posted by Alvaro Dee on April 25, 2016 at 10:43pm

Scope of Data Entry from Images and their Range of Service

We all know that a document's image is valuable only when the information it contains is digitized and stored in a suitable format. Scanned images data entry calls for great amount of accuracy as inaccurate data can influence the entire database. Also, image data entry is a very tedious and time consuming process. Hence, it is best to take the help…

Continue

Posted by Alvaro Dee on March 30, 2016 at 9:30pm

Packt publishing releases "Advanced Oracle PL/SQL Developer Professional Guide-Second edition"

I am pleased to inform you all that Packt publishing has released the book "Advanced Oracle PL/SQL Developer Professional Guide-Second edition" after my second stint with them. This book is for Oracle developers responsible for database management. Readers are expected to have basic knowledge of Oracle Database and the fundamentals of PL/SQL programming. Certification aspirants can use this…

Continue

Posted by Saurabh K. Gupta on February 26, 2016 at 12:57am

Routing Oracle AQ messages using Apache Camel in ServiceMix

I'm working in how to connect Oracle AQ JMS messaging with other systems, using Apache Camel in ServiceMix: https://fcosfc.wordpress.com/2016/02/06/routing-oracle-aq-messages-using-apache-camel-in-servicemix/

I hope it will be useful!

Posted by Paco Saucedo on February 13, 2016 at 2:37am

© 2016   Created by Steve Karam.   Powered by

Badges  |  Report an Issue  |  Terms of Service