Default sorting order used by oracle

Can anyone please let me know whether oracle uses any default sort order or not when executing an sql which does not have any sort order/ order by clause?
I have a sql query where no sort order is specified.
Now if I add some more columns in the select clause and execute the same query, the number of records returned are same and also the records are same.
But the order in which they are displayed is different from the previous query.
Could anyone please let me know whether oracle uses any default sort order or not when executing an sql which does not have any sort order/ order by clause
or does it depend on the columns of the table?
Thanks in advance.

To answer your direct question "why the order in the previous example differ".
When you added additional columns to the select list, that changed the query plan generated for the query. This caused Oracle to pick up the rows in a different order. There are a number of reasons this could happen, the new selected columns caused a different index (or no index) to be used for one of the tables in the query, it caused a different table to be be used as the "driving" table (i.e. the first one accessed), it caused a different join method to be used.
HTH
John

Similar Messages

  • Sorting technique used by oracle for "order by" clause.

    Hi All,
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    Issue i am facing :
    Table : xx
    Line Date
    1 05-06-2013 00:00:00
    2 05-06-2013 00:00:00
    when we query above table using order by date, it is returning line 2 prior to line 1. we would like to know why it is returning line 2 first?
    Regards,
    Ram

    >
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    >
    Well ok - but be warned that many people wind up being sorry they ask that question. Hopefully Hemant's answer is what you really wanted.
    See 'Linguistic Sorting and String Searching' in the Oracle® Database Globalization Support Guide
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch5lingsort.htm
    Sorting will be controlled by the settings of NLS_LANGUAGE, NLS_SORT and NLS_COMP.
    Here is the doc page for NLS_SORT
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008393
    >
    NLS_SORT specifies the type of sort for character data. It overrides the default value that is derived from NLS_LANGUAGE.
    NLS_SORT contains either of the following values:
    NLS_SORT = BINARY | sort_name
    BINARY specifies a binary sort. sort_name specifies a linguistic sort sequence.
    >
    And the one for NLS_COMP
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008458
    >
    The value of NLS_COMP affects the comparison behavior of SQL operations.
    You can use NLS_COMP to avoid the cumbersome process of using the NLSSORT function in SQL statements when you want to perform a linguistic comparison instead of a binary comparison. When NLS_COMP is set to LINGUISTIC, SQL operations perform a linguistic comparison based on the value of NLS_SORT. A setting of ANSI is for backward compatibility; in general, you should set NLS_COMP to LINGUISTIC when you want to perform a linguistic comparison.

  • Want to change the default sort order of a Advanced table

    Hi all ,
    Hope all of you doing good.
    I am trying to change the deafult sort order of a " View Applicants" advanced table on Irecruitment selfservice page , using personalization feature but its not sorting as expected.
    The default sort order is asc by the name of the applicants. I wanted to override it by " Date Applied " desc using personalizing the advanced table.
    But its not sorting by Date applied and still shows the sort by applicant name.
    Any inputs will be greatly helpful
    I am using the Oracle Apps 11.5.10 version.

    Hey guys m I got the answer for the below question.
    Oracle have few Restriction and limitation on such Advanced table in sorting the data,
    Few of them are as mentioned below ...
    1. Sorting is not allowed for tables that allow inserts.
    2. Sorting is not supported for tables containing updateable columns
    3. Sorting is disabled when the Select column is checked for a row in a table or when Hide/Show is present in a table.
    Because of the above limitations , we cannot sort or override the existing alphabetical name sort order to Date applied sort order on the View Applicant advanced table.
    You can observe that , View Applicant page is having an option called "Update Status" which allow us to update applicant’s status or rating in the Advanced table.
    On such updatable advanced tables, oracle does not allow us to override the sort order on any of the table columns.
    Keeping it in a nutshell , I can say it's does not allow us to change the sort order of the view applicant advanced table ( which is having updateable columns ) to sort them in Date applied instead of Name( which is default ).

  • Default Sort Order for Library View

    It would be fantastic if there were a user defined preference for a default sort order in Library view. For example, some users may prefer to always view the images by File Name, or Rating, etc, without having to change the sort order for each individual folder they view via Lightroom.
    Thanks!

    Thanks for your suggestion Allan, but it doesn't work.
    I'm specifically referring to the defaults that Aperture 3 adopts when you use the "File, Import, Folders as Projects with the projects and albums setting.
    What I'm finding is regardless of the setting in the Library preferences, the default sort order for the project is Date and Manual for the album.
    Yet if I create a project manually the default sort order is as per the Library prefs. Strange.

  • How to set default sorting order in ADF Table

    Hi,
    I want to set the default sorting order as ascending in adf table. Please help me regarding how can we do it.
    Using JDev 11.1.1.5.0

    Hi Frank,
    Thanks for the quick reply.
    I have done binding of table with list of pojos.
    The Class for which Data control is created is as:-
    public class DemoDC {
        private List<TableEntity> tableList =
            new ArrayList<TableEntity>();
        public List<TableEntity> getTableList() {
            return tableList;
        public void setTableList(List<TableEntity> tableList) {
            this.tableList = tableList;
    where TableEntity is a pojo which has all the columns as its attributes.
    Now when i do the above steps , after clicking on pencil icon and seecting the iterator name in the iterator tab (DemoDC-> tableList) , and selcting the 'sort criteria' tab when i select a column and try to set the sort order  I get error as ' Iterator can not be created for the selected node ' .

  • How to restore default sort order on a table?

    Have an ADF table with some sortable columns, populated by an SQL view (having its own Order By).
    Looking for a way to let user revert to default sort order after sorting columns.
    Currently, I have a button linked to:
    public String cmdRefreshOrders() {
    this.getTblOrders().setSortCriteria(null);
    DCIteratorBinding iter = ADFUtils.findIterator("iterUnderlyingTable");
    iter.executeQuery();
    return null;
    This doesn't work
    Any ideas?

    Tried. Doesn't work.
    Iterator doesn't have a setOrderByClause() -- closest I see is applySortCriteria(), which takes an array of SortCriterias, not a String. Might be able to parse Order By string to create array of SortCriterias, but this smells wrong. Probably wouldn't work anyway because ...
    Tried doing iter.applySortCriteria(null) before executeQuery. This accomplished nothing -- the sort created from clicking the column header persisted.
    Looks to me like the sort is persisting as some property in the table or in the display column.
    Any more ideas?
    Thanks
    Ed

  • Defining sort order using parameter fields

    Post Author: vandersee
    CA Forum: General
    I've created a report, the contents of which is sorted depending on a parameter selected (method used is as described in the help topic entitled "Defining sort order using parameter fields".  Is it possible to vary the Sort Direction (ascending/descending) using parameters also, so that if I choose to sort by field A it will be ascending, but descending if I choose to sort by field B?

    Post Author: V361
    CA Forum: General
    You can create a Parameter {?Sort Order}  make it a string, and add items A to Z and Z to A and a formula and sort the group using the formula.
    Group Expert, select the group, select options, check use a formula as group sort order
    if {?Sort Order} = "A to Z" then crAscendingOrder else crDescendingOrder
    And your group will sort based on what is selected in the parameter.

  • How to set default sort order for all folders/albums/etc

    This is driving me nuts, having to change the sort order from manual to file name every time I change projects or folders (and I have a lot of both). Is there a way to set the default to just sort by file name ascending? Or sort by timestamp (that's date + time, not just date)?

    Chuckcars wrote:
    I am in process of doing some rearrangement to make Projects as the main box (the file drawer) with headings like: iPhone, Assignments, Events, Landscape, People, Travel. Then, a specific folder under the project. Then, an Album under the Folder.
    This should be started as a new thread -- do so if you have any questions.
    Strongly recommend using Projects as intended (see comments by Frank and DLSCreative in current thread ^1^ and long comment by me in another thread ^2^ ). In your case that would mean Folders with the headings you've selected, the (most likely) Projects, then Albums (and perhaps more Folders).
    ^1^ http://discussions.apple.com/thread.jspa?threadID=2716711&tstart=0
    ^2^ http://discussions.apple.com/thread.jspa?threadID=2654297&tstart=0

  • MDO select query: how to control sort order using parameter

    Hi experts, is there a way of controling the sort order of an MDO select query using some parameter?
    I was thinking about using some statement like CASE [Param.1] WHEN 'abc' THEN [ORDER_NO]...END in sort section of the query but it is not working.
    Of course I colud go for various select queries...but I am wondering if it can be done using only one?
    Any ideas?
    Thanks for any help

    Hi Marco,
    Yes this can be achieved dynamically using SortExpr under dynamic link assignment in MDOAction block if you are using a transaction to call it.
    Please check below thread:
    Re: MDO Query Action Block In MII Transaction
    Or else, this [Param.1] thing should work as well provided it doesn't get the logic part in it, just pass the columns names separated by comma. Haven't tried it though, will check it for you.
    Best Regards,
    Swaroop

  • Default sorting order

    Hello,
    When I search for a specific podcast, it lists 50 entries from the feed, on the iTunes search page. The default selected column is the first one; 1-50. How is this order primarily determined? By popularity? I'm noticing jumbled up entries. For example, old ones mixed with new ones. It seems like it is sorted by popularity, but wanted to confirm.
    Thanks for your assistance.

    Apple's Podcast Tech Specs page says:
    'The order in which the episodes appear is based on the pubDate for each item, with the most recent episodes appearing at the top of the list.'
    However clicking on different columns will produce a sort order based on the contents of that column.

  • Default Sort in Presentation in Oracle BPM 10

    I have a sortable (sort enabled) table in a presentation
    And I want my table to be loaded with a default sort.
    How can I do that?

    Hi user9293762,
    To pass the BPM object to the JSP page, please follow the below steps:
    1) Place an interactive activity after the method execution.
    2) Right click on the Interactive activity and select Main Task
    3) In the Main Task wizard select Implementation Type as BPM Object Interactive Call
    4) Select the BPM Object Variable, here you can pass your BPM object to the jsp page but make sure that the object you want to pass is an instance variable of type your BPM object
    5) Click on the Use JSP Presentation and choose for your jsp page you want to attach with the interactive activity.
    6) Finally click on OK
    Now you can access the BPM object in your jsp page.
    Bibhu

  • Sort Order problem in Oracle 11g

    Hi,
    While executing the below query in 10g and 11g, I got different results.
    SELECT loan.Ins_Id,
    ARev.revision,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and ARev.revision=
    (select max(revision) from Acc_REV where Loan_Id =
    (select max(Loan_Id) from LoanAcc where Ins_Id =Ins.Ins_Id
    ) AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Result in Oracle 11g
    INS_ID  REVISION  Acc_ID   Loan_Id
    707      2      312    238
    691      1      312    234
    Result in Oracle 10g
    INS_ID  REVISION  Acc_ID   Loan_Id
    691      1      312    234
    707      2      312    238
    The order in both the cases were different.The order in 11g was not in ascending order.Though the data in both the databases
    is same. Could anyone please tell me why is this happening?. Is there any diffeence in the architecure of ORDER BY (sort) in
    10g and 11g. If I modify the above query by avoiding the subquery I get the correct result(i.e in ascending order).
    SELECT loan.Ins_Id,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and ARev.revision in ('100','101')
    AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Edited by: KZON on Apr 7, 2011 4:46 AM

    Hi all,
    I have modified the query by giving To_Number(ARev.revision) before sub query. Now Oracle 11g returns results in ascending order. But 10g returns results in ascending order with out using To_Number()
    NOte:- Type of ARev.revision is VARCHAR
    SELECT loan.Ins_Id,
    ARev.revision,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and To_Number(ARev.revision)=
    (select max(revision) from Acc_REV where Loan_Id =
    (select max(Loan_Id) from LoanAcc where Ins_Id =Ins.Ins_Id
    ) AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Result
    INS_ID  REVISION  Acc_ID   Loan_Id
    691      1      312    234
    707      2      312    238
    Is there any difference in ORDER BY clause in Oracle11g and 10g ?
    Edited by: KZON on Apr 7, 2011 4:45 AM

  • How to Change String Default Sort Order for Table?

    I have a RichTable with SortableModel, but all string properties sort as follows:
    AAAAAA
    ZZZZZZ
    aaaaaa
    bbbbb
    zzzzzz
    As you can see upper case is before lower case, however I know I'm going to be told that they need to be like this:
    AAAAAA
    aaaaaa
    bbbbb
    ZZZZZZZ
    zzzzz
    Is there a way I can change / override how this sorts?
    Thank you,
    Kris

    So I think you are saying that I need to create my own wrapper class for String. Then override the compare and equal methods and return this class in my getters and setters?
    Or is there a way to tell the String class to use a different method for sort since it would be a global change?
    Thank you,
    Kris

  • Default Sort order for Search and Advanced Search

    Does anybody know of any easy way to default search to show results by "last modified date" ?
    Much thanks,
    ~Kevin.

    You might try logging in as the guest user and editing the guest user preferences / search preferences as described by in the earlier posting. Also you can configure search by passing parameters in the URL - should be info about that in here somewhere...

  • How do I retain the default 3 column sort order in a standard report

    I have a standard (not interactive) report of about 12 columns in which I set column 1 as the primary sort, column 2 as the second sort within that and column 3 as another sort within 1&2. I have also made other columns sortable by the user. However, once a sort is done by the user on one of the other columns, the default sort order never seems to come back, even if the application is closed. Is there something I need to set?

    Standard report sort columns are stored persistently as user preferences. The <tt>apex_util.remove_sort_preferences</tt> method can be used to remove them, resetting reports to the default sort order. However this is not a precision instrument: it removes the user's sort preferences for all reports...
    It is possible to remove the sort preference for individual reports using the <tt>apex_util.remove_preference</tt> method by reverse engineering the required sort preference name from the admin user preference report, but I wouldn't recommend it. I recently worked on an application where this had been done for one report, but we removed this "feature" as: (1) no one could remember why it had been done in the first place; (2) it was completely inconsistent with the behaviour of the other app reports; (3) the implementation was Byzantine (get non-obvious pref value and have page re-request itself with additional parameters) and lead to (4) poor page performance.
    Unless users are jumping up and down demanding this I'd stick to the status quo...
    (Please update your forum profile with a better handle than "user719232".)

Maybe you are looking for