Wednesday, January 7, 2015

How to get Sql query for order by in respecive of Case Insensitive in Oracle

create table test (case varchar2(10));
 
Table created. 
 
 insert into test  values('a');
 insert into test  values('B');
 insert into test  values('c');
 insert into test  values('D');
 insert into test  values('E');
 insert into test  values('D'); 
 insert into test  values('D');
select * from test  
 
CASE
 
D
f
a
B
c
D
E
D
f   
 
 select * from test order by case 
 
CASE 
 
B
D
D
D
E
a
c
f
f 


select * from test order by order by nlssort(case,'NLS_SORT=BINARY_CI');
 
CASE       
----------
a          
B          
c          
D          
D          
D          
E          
f          
f          
 9 rows selected  

No comments:

Post a Comment