This discussion is archived
3 Replies Latest reply: Sep 26, 2013 6:08 AM by roger b. RSS

Order By clause not working

roger b. Newbie
Currently Being Moderated

I have a very basic SQL statement that I am running on a simple three column table. I simply want to select two of the three columns basing the selection on one column and ordering by the other. I am using Release 9.2.0.1.0 and I have tried using SQL Plus as well as Toad 10.6 and the results are the same in both. My problem is that even though I am using an Order By clause the results are not being sorted. I've written countless statements and never had an issue with the Order By clause before. I'm perplexed.

 

SQL Statement Executed:

Select COL3 From Table1 Where COL2=1 Order By COL3;

 

Result:

Dxxxxx                                                                          
Nxxx Mxxx/Cxxxx Cxxx                                                           
Nzzzz Ezzzz  
Oxxxxxxxxxx Exxxx                                                                 
Rxxxxxxxxx Exxxx                                                              
Sxxxxxxx Exxxx                                                              
Sxxxxxx Hxxx                                                                
gxxxxxxx

 

Note that I replaced all but the first letter of each word woth alterate letters. There is nothing remarkable about the table:

 

SQL Statement Executed:

Desc Table1;

 

Result:

TABLE Table1
Name                                      Null?    Type                       
----------------------------------------- -------- ----------------------------
COL1                                                   NUMBER                     
COL2                                                   NUMBER                     
COL3                                                   VARCHAR2(255)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points