sql - Order by case insensitive in oracle -


i want order following text in following order but, after trying following query not working.

values order "a", "b", "y", "z", "a", "b", "y", "z".

expected result "zzyybbaa"

select col table order col desc; select col table order upper/lower(col) desc; result-> zzyybbaa select col table order nls_upper/nls_lower(col) desc; result-> zzyybbaa 

first of all, can order upper (or lower) case of column, once you've done that, need sort text order on initial letter; eg:

with sample_data (select 'a' txt dual union                      select 'b' txt dual union                      select 'y' txt dual union                      select 'z' txt dual union                      select 'a' txt dual union                      select 'b' txt dual union                      select 'y' txt dual union                      select 'z' txt dual) select txt   sample_data order upper(txt) desc, txt;   txt --- z   z   y   y   b   b       

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -