Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Posts
    37

    Unanswered: How can I change sort order procedure in DB2?

    Hi,
    We know that different databases will respond to a querry in a different way with ORDER BY clause.
    See the difference between DB2 & ORACLE while fetching the records using ORDER BY clause.

    Difference I found is as follows:

    Consider a table Mytable & column in that is 'name'
    Input for ‘name’ filed: ajay,Abhi,Balu,balu,Cathy,cathy,Ferry,ferry,David, david.
    Querry: select * from Mytable ORDER BY name
    DB2 output: ajay,Abhi,balu,Balu,cathy,Cathy,david,David,ferry, Ferry
    ORACLE output: Abhi,Balu,Cathy,David,Ferry,ajay,balu,cathy.david, ferry.
    Did u get the difference?
    DB2 is giving the first priority to lowercase letters & then upper case letters.(i.e first priority to 'a' if it exists & then second priority to 'A' if it exists)
    Whereas in Oracle first all uppercase letters are getting higher priority & then lowercase letters later.

    Now I want to bring the same output in DB2 as coming in ORACLE as below stated.
    ORACLE output: Abhi,Balu,Cathy,David,Ferry,ajay,balu,cathy.david, ferry.
    DB2 output:Abhi,Balu,Cathy,David,Ferry,ajay,balu,cathy .david,ferry.
    Is it possible?

    *****I have one idea that if we change some environment variable we can achieve our goal.What is your comment on this?
    If not possible in that way tell me your further suggession.*****

    Looking for any one of your response.
    grateful if you help me in finding this.

    Thanks,
    Narender

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: How can I change sort order procedure in DB2?

    I think this has something to do with the COLLATING SEQUENCE you defined when creating the database ....

    Read the db2 manuals (sorry, but you need to ) for more info
    Cheers

    Sathyaram
    Originally posted by pnarender
    Hi,
    We know that different databases will respond to a querry in a different way with ORDER BY clause.
    See the difference between DB2 & ORACLE while fetching the records using ORDER BY clause.

    Difference I found is as follows:

    Consider a table Mytable & column in that is 'name'
    Input for ‘name’ filed: ajay,Abhi,Balu,balu,Cathy,cathy,Ferry,ferry,David, david.
    Querry: select * from Mytable ORDER BY name
    DB2 output: ajay,Abhi,balu,Balu,cathy,Cathy,david,David,ferry, Ferry
    ORACLE output: Abhi,Balu,Cathy,David,Ferry,ajay,balu,cathy.david, ferry.
    Did u get the difference?
    DB2 is giving the first priority to lowercase letters & then upper case letters.(i.e first priority to 'a' if it exists & then second priority to 'A' if it exists)
    Whereas in Oracle first all uppercase letters are getting higher priority & then lowercase letters later.

    Now I want to bring the same output in DB2 as coming in ORACLE as below stated.
    ORACLE output: Abhi,Balu,Cathy,David,Ferry,ajay,balu,cathy.david, ferry.
    DB2 output:Abhi,Balu,Cathy,David,Ferry,ajay,balu,cathy .david,ferry.
    Is it possible?

    *****I have one idea that if we change some environment variable we can achieve our goal.What is your comment on this?
    If not possible in that way tell me your further suggession.*****

    Looking for any one of your response.
    grateful if you help me in finding this.

    Thanks,
    Narender

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •