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

Similar Messages

  • Problem with Oracle 11g(32 bit) installation on windows 7 ultimate edition

    Hello all,
    I have a problem with Oracle 11g(32 bit) installation on windows 7 ultimate edition (32 bit).
    I have successfully installed it immediately after OS installation. But today, i have decided to deinstall it and go for Oracle 10g version for 32 bit.
    Everything went normal during installation, but i can see the services is not present in services.msc. Also its throwing some exception for dbca, netca
    Now i tried to deinstall it and again go for 11g. But even the same story here..
    Can anybody give me a solution for this..
    -Regards
    Rajesh Menon

    Saqib Alam wrote:
    i recently install Oracle 11g R1 on windows 7 ultimate, i installed it and working perfectly.
    ur problem is that u install latest version and now u trying to installing old version.
    now u need to uninstall 10g and delete oracle from services, if the probleme presist then u should
    install fresh windows 7.
    Regards
    SaqibNo need to install a fresh OS. That's like tearing your house down just because you wired a lamp wrong and blew a circuit breaker.
    There are MeaLink notes on how to eradicate an Oracle install from Windows, but it boils down to this:
    Stop all Oracle services
    In the registery:
    - Delete all oracle services from the register (HKLM\SYSTEM\CurrentControlSet
    - Delete the entire Oralce folder from HKLM\Software
    reboot
    Delete the ORACLE_HOME directory and any other Oracle related directories/files. Offhand, it seems like there is an Oracle directory under Program Files.
    reboot

  • Artist sort order problem

    Hi.
    I have music sync'd via iTunes Match from my laptop to my iPad and to my iPhone. The names and order appear correct on both the laptop and on the iPad but on the iPhone several artists are either shown in all lower case or the last name will be used by the sort, rather than the first.
    I've reset the artist, album artist and sort artist tags to different names (and they show up correctly then on the iPhone) and then set them back, but the problem remains.
    I'm thinking that the iPhone has a corrupt file somewhere - but how can I reset that without losing everything on the phone?
    A factory reset and restore from iCloud results in the same problem.
    Any ideas?
    Thanks guys.
    --Cynan.

    I also have an Artist sort order problem. While the circumstances are quite different from yours, I wonder if it's due to a similar corruption problem. I don't use iTunes Match. I found Kenny G listed under letter T.

  • Uninstallation problem in oracle 11g

    i have uninstall ed oracle 11g from my computer but still the folder app exists when i delete the folder it is giving me message that cannot delete oci.dll file
    Access Denied Make sure disk is not full, or write - protected and that file is not currently in use
    iam not understanding what is actually happening
    please somebody help

    uninstallation problem in oracle 11g
    Please refrain from posting in multiple forums like this. It's tantamount to abuse of the forums.
    Please mark this thread as answered and continue on in your other thread, where this question belongs.

  • Tns problem with Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools

    I installed the full
    Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools for Visual Studio
    now I am at the good old "[ORA-12154: TNS:could not resolve the connect identifier specified]" error.
    I copied the same tnsnames.ora as used on the db server
    onto the client "C:\Oracle\product\11.1.0\client_2\Network\Admin".
    The host name is right since a normal ping works. TNSping is not available.
    but I get the [ORA-12154: TNS:could not resolve the connect identifier specified] error.
    The listener is running and the instance as well since it all works on the source server.
    I tried it with
    SET path=c:\oracle\product\11.1.0\client_2\bin
    but tnsping is still not recognized.
    sqlplus works on the other hand when I set it to
    SET path=c:\oracle\product\11.1.0\client_2\
    what is going on...

    hey
    u can post your query here, and i think everyone here is to share opinion so do not hesitate to do so and please try to google before posting here,
    and we know no one is expert like some people saying 'boring questions' you just try to overcome your problem and you will definitly get your problem solved .
    some mpeople ar still there who answeres hopeless questions and say nothing about them but when a fresher askin a qustion is not tolarated by them they think everyone is born DBA here
    they always tend to discouraging people here on forums,and i think they are vvolunteers to reduce crowd here on forums, inspite of there experience and people respect them they can not control their anger
    so please post you tns here, i think there are ways to ask people to google and search docs first, but not like this
    thanks and regards
    VD
    Edited by: vikrant dixit on Jun 29, 2009 4:33 AM

  • Sort Order problem in a cursor

    Hi,
    I have a cursor where the sort order needs to be specified dynamic. I have declared variables (say x and y) which contains the numbers. When I use them in the order by clause, though no compilation error, but the sorting does not occur.
    Eg. Cursor C1 is
    Select col1,col2
    from tab1
    where ...
    ORDER BY x (the value of x is 2).
    Your help is greatly appreciated. (This cursor is in Oracle Forms)
    Thanks

    How come this works:
    select samp1,samp2
    from   (select 'abc' samp1, 123 samp2 from dual union all
            select 'mno' samp1, 456 samp2 from dual union all
            select 'def' samp1, 3 samp2 from dual union all
            select 'pqr' samp1, 12 samp2 from dual union all
            select 'jkl' samp1, 64 samp2 from dual union all
            select 'stu' samp1, 10 samp2 from dual union all
            select 'vwx' samp1, 88 samp2 from dual union all
            select 'ghi' samp1, 7 samp2 from dual union all
            select 'yzz' samp1, 1 samp2 from dual
            ) testdata
    order by &x
    Enter value for x: 2
    old  12: order by &x
    new  12: order by 2
    SAM      SAMP2
    yzz          1
    def          3
    ghi          7
    stu         10
    pqr         12
    jkl         64
    vwx         88
    abc        123
    mno        456
    9 rows selected.
    select samp1,samp2
    from   (select 'abc' samp1, 123 samp2 from dual union all
            select 'mno' samp1, 456 samp2 from dual union all
            select 'def' samp1, 3 samp2 from dual union all
            select 'pqr' samp1, 12 samp2 from dual union all
            select 'jkl' samp1, 64 samp2 from dual union all
            select 'stu' samp1, 10 samp2 from dual union all
            select 'vwx' samp1, 88 samp2 from dual union all
            select 'ghi' samp1, 7 samp2 from dual union all
            select 'yzz' samp1, 1 samp2 from dual
            ) testdata
    order by &x
    Enter value for x: 1
    old  12: order by &x
    new  12: order by 1
    SAM      SAMP2
    abc        123
    def          3
    ghi          7
    jkl         64
    mno        456
    pqr         12
    stu         10
    vwx         88
    yzz          1
    9 rows selected.Isn't this what is wanted?
    -Marilyn

  • Potentialy serious problem with Oracle 11g R1

    Today i have download to try Oracle 11g , my system supports database system
    requirerments and into installation progress my antivirus software find some troyan horses and my antivirus software is ordinary not powerfull .Do someone have the same problem?

    Yes, Trojan found in ott.exe. I believe this may be a false alarm because of its filename, which is the name of a known malware. Only some antivirus detected it.
    Since it's just one file, use whatever your antivirus has for isolating it, or just delete it.

  • Month Sort Order Problem in Time Dimension(Essbase with Obiee)?

    Hi All,
    I am facing issue with month order in answers.
    First I created BSO cube using Essbase Studio. When i exposed cube in answers, months were sorted in alphabetical order. So i used RANK function with evaluate to arrange month members in proper order. But if i use RANK function it pulls all missing records and it is effecting performance.
    Then i created Time dimension(dimension loading) in essbase from FLAT file,initially it was coming in proper order. But after some time again it sorted in alphabetical order!!!
    I have seen in internate few people saying they didn't face this problem. I
    Please advice...
    Essbase: 11.1.1.3
    OBIEE: 10.1.3.4.1
    RS

    Hi user10300020,
    That's a fairly common problem with months that happens regardless of database source.
    In the logical layer of OBIEE you can specify the sort order on the month name column. Just double click on the month name column and look for the option to set sort order based on a different column. I typically sort the month name based on the month number.
    Give that a shot and tell me if it works.
    -Joe

  • Problem regarding oracle 11g

    sir/mam
    i am facing a problem in installing the oracle 11g.. after installing the software. when i am going on command prompt then it is asking for user name and password. after then it is showing that connected to oracle. then when i am clicking on the desktop icon get started with oracle database 11g, it is opening a web page. i am not getting what to do after that..?????
    sir/mam please give me some advice.. its very urgent.
    thanks a lot..

    Hi,
    Reading Database Express Edition Getting Started Guide might help
    http://docs.oracle.com/cd/E17781_01/admin.112/e18585/toc.htm
    Regards,
    Jari
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Problem Installing Oracle 11g. Please Help!

    Hello All,
    I need to install Oracle 11g Release 2  database on my machine:
    Windows 7 Enterprise
    64 bit Operating System
    Service Pack 1
    I ran into problems right before  I reach the Installation Options Screen
    The error message is:
    Unable to establish a network connection to proxy server. Specify the correct proxy details.
    I have tried entering the correct Proxy server information but it gives me the same error.
    Please Help
    Thanks

    HI,
    If you are not using proxy or if you want to continue without connecting to internet, you can just continue without providing these details
    Regards
    Yoonas

  • 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

  • Problem Installing oracle 11g in Fedora 8

    Hi,
    I am trying to install oracle 11g in Fedore 8. The problem I am facing is that it is not starting the universal oracle installer. It is giving that DISPLAY is not set properly. I tried to do the following:
    DISPLAY=<machine-name>.0.0;export DISPLAY
    but it is not working.
    Can any one advise regarding installing 11g in linux.
    Thanks,
    Mahboob

    Details! What is the exact message, if any, that you get?

  • Date problem in oracle 11g

    iam New to oracle 11g but familiar with SQL 2005
    i have a table Patient which has a column Date_Of_Birth has datatype Date
    and iam writing a query in which if Date_Of_Birth column has a value
    *01/01/1900* then i should be replaced by *' ' or balnk*
    otherwise show date value for that i have made use of
    case
    query
    select case(Date_Of_Birth)-------------this is my column
    when '01/01/1900'
    then ''
    ELSE TO_CHAR( Patient.Date_Of_Birth, 'DD/MM/YYYY')
    END Date_Of_Birth
    from Patient -------------my table
    but error is comming
    Error starting at line 1 in command:
    select case(Date_Of_Birth)
    when '01/01/1900'
    then ''
    ELSE TO_CHAR( Patient.Date_Of_Birth, 'DD/MM/YYYY')
    END Date_Of_Birth
    from Patient
    Error at Command Line:2 Column:5
    Error report:
    SQL Error: ORA-00932: inconsistent datatypes: expected DATE got CHAR
    00932. 00000 - "inconsistent datatypes: expected %s got %s"
    *Cause:   
    *Action:
    Edited by: user13066438 on Jan 24, 2011 9:38 PM

    Hi there
    you have date data type in Date_Of_Birth you have to use to_date function
    try this
    select case((Date_Of_Birth)when to_date('01/01/1900', 'DD/MM/YYYY')
    then ''
    ELSE TO_CHAR(Patient.Date_Of_Birth, 'DD/MM/YYYY')
    END Date_Of_Birth
    from table_name;regards
    Hitesh

  • "Date Added" sort order problem when importing folders

    I sort by "Date Added" to view my iTunes library, and use the middle "view" button to view tracks grouped as albums with artwork. This works mighty well except when I'm importing folders containing the files in an album, such as those I get from eMusic--the tracks are displayed out of order when I do this. The only solution I've found so far is to import one track at a time. Any ideas how I can get those tracks in there in the right order when importing a folder? Any scripts hanging around that will do it right? Thanks to all....

    What sort order do you have selecting in the sort drop-down?  There is no "correct" sort order.  You can sort on any metadata you can show in the Browser.  The sort drop-down is located in the top border of the Browser, near the left corner.  Every container in Aperture retains the sort order it last had.  When you manually move an Image in the Browser, the sort order is changed to "Manual".

  • ATV 4.4.2 photo sort order problem

    I have just updated my Apple TV (I believe it is now 4.4.2)
    When I view my photo albums, the sort order is not the same as that in my iPhoto.
    It was before the update.
    I resorted the albums again in iPhoto, they look just right on my MBP.  They also look exactly the way I wanted it on my iPad2 and my iPod.  But on Apple TV, it's all wrong again.
    I have invited friends over this weekend for a presentation that I want to show them slides on the Apple TV.  I am dead meat now.  Please advise.
    Thank you in advance.
    Eddie

    I did some additional testing using my Apple TV (1st generation) and my Windows 7 computer, and this is what I found.
    (This likely applies to iPad/iPod/iPhone too).
    Apple TV displays photos in order of their "Date Created" file attribute.
    If the "Date Created" file attribute of all photos in an album is identical, then Apple TV displays the photos in alphabetical order.
    This I what I do to make sure that Apple TV displays photos in the order I want them to be in:
    First, I arrange photos in the order I want them to be in. For this, I use Google Picasa, but one could also use FastStone Image Viewer, or any similar tool.
    Then, I bulk rename all the photos, so that their file names are in alphabetical order. I do this from within Picasa, but there are many other freeware file rename tools one could use for this.
    Next, I bulk change the "Date Created" file attribute of the photo files, so that they all have an identical one. For this, I use BatchTouch, freeware available for Windows and Mac.
    Finally, I open iTunes, and sync the photos to my Apple TV.
    Note: if they photos were already synced to your Apple TV before you perform the steps above, you may need to this beforehand:
    Open iTunes on your PC, and make sure that the correct photo folder is selected for syncing to your device.
    Using Windows Explorer, navigate to this folder.
    Within it, locate a subfolder called “iPod Photo Cache” ("iPad Photo Cache for iPad syncing) and delete it.

Maybe you are looking for

  • Ipod touch no longer charges after update from IOS 7 to 8.1

    Just updated the signed iPOD Touch Product Red my son got for his first communion in June from iOS 7 to 8.1. Update went fine was done while the iPod was connected to the outlet. HOWEVER: Now the iPOD is flat and he will nog onger charge or startup,

  • Navigate Value Interaction not working with UNIONs displayed as pivot

    hi all - If created dozens of requests the uses drilling. Now I'm getting strange behavior in a certain scenario... I have a request that is a pivot view and contains UNIONs. One of the columns, employee name, is set up as 'Navigate' for the Value In

  • Cannot reinstall PS5 on the same PC

    Last week I have reinstalled my PC with Win7 Ultimate (clean install) As I was having some problems after installing PS5 as well, I uninstalled it from Programs and Features to reinstall it. Now I cannot reinstall it any more. I checked with the 'Adv

  • Upgrade problem or windows

    Hi just upgraded to 8.02 and noticed that I now when previewing a flash item " press space bar or ...... to enable" if I click once the item becomes live and a second click carries out the action. Is this a windows thing or flash/dw? cheers Ian

  • IOS 8.2 and Video Podcast Bug

    Is there a problem with losing video when playing consecutive video podcasts in IOS 8.2? I subscribe to NASA HD video feeds, and recently discovered a problem where the first video podcast I select plays perfectly, but when it automatically goes to t