Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sort order on date and character columns not working as expected.

user10151069Jul 26 2018 — edited Jul 27 2018

I am not sure this how the sort works or is this an issue. Are there other ways to get this to as expected.

Oracle 12.2.0.1.

My code:

desc datesort

Name                                      Null?    Type

------------------------------------------------------------------------------------------------------------------------------------ -------- --------------------------------------------------------------------------------------------------------------------

NAME                                                VARCHAR2(30)

MDATE                                                DATE

select * from datesort order by 2 desc, 1 asc;

NAME                           MDATE

------------------------------ ---------

Att                             26-JUL-18

Shell                          26-JUL-18

shell                          26-JUL-18

SHELL                      26-JUL-18  <<<< not sorting as expected

ATT                           26-JUL-18  <<<< not sorting as expected

att                             26-JUL-18

BITCOIN                  26-JUL-18 <<<< not sorting as expected

BITcoin                    26-JUL-18 <<<< not sorting as expected

Bitcoin                     26-JUL-18 <<<< not sorting as expected

ATT                         25-JUL-18

SHELL                    25-JUL-18

Shell                       25-JUL-18

ATT                        24-JUL-18

SHELL                   24-JUL-18

Shell                      24-JUL-18

att                          24-JUL-18

shell                       24-JUL-18

Am I missing anything or is this the way it works.

Thanks!

This post has been answered by Paulzip on Jul 26 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 24 2018
Added on Jul 26 2018
11 comments
11,703 views