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: 248

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

Verify and Fix Corruption in Oracle Databases, Efficiently

Oracle database system stores massive amounts of data, aiming for secure data storage and management. With a number of predefined queries, this database system lets you insert and retrieve data that is stored in multiple tables inside it. For smoother functioning of a database system and its respective databases, your machine must be free of every single issue that is supposed to cause adverse effects on the data. For…

Continue

Posted by Mark Willium on June 3, 2014 at 11:00pm

esProc Enables Oracle JDBC to Speed Up Retrieve Process

Recently, a performance issue occurs in a big detail report, where the original data volume in the two data tables as it involves has exceeded 3 million rows; the data volume that the report can retrieve after filtering remains at round 2 million rows. As we expected before, by using paged retrieve method, this report would present a much higher performance. However, for the fact that the user also needs to…

Continue

Posted by Jim King on May 29, 2014 at 7:00am

Oracle DBaaS in Private Database Cloud workshop

Designing Database as a Service (DBaaS) in own Database Cloud is very comprehensive topic and it requires a lot of things: clear concept and strategy, solid planning, important architecture decisions, considerable involvement of different stakeholders, extra budget, etc. To start talking about this topic I’ll give my own definition of DBaaS which is a managed database service, hosted and offered by DBaaS provider on pay-per-usage basis, which provides access to own database resource with…

Continue

Posted by Kirill Loifman on May 5, 2014 at 12:37am

© 2014   Created by Steve Karam.

Badges  |  Report an Issue  |  Terms of Service