没怎么看懂,是不是这个
 order by decode('radio1_1', 'radio1_1', 'RELY_NO desc',
'radio1_2', 'TORIHIKI_NAME', 'radio1_3', 'TANTONAME_E, TANTONAME_J')给你个例子看有没有帮助
SQL> create table t as select rownum id from user_objects where rownum < 4;Table created.SQL> create function f(id int) return number as
2 begin
3 if id = 2 then
4 return 3;
5 elsif id = 3 then
6 return 2;
7 else
8 return id;
9 end if;
10 end;
11 /Function created.SQL> select * from t order by f(id);ID
----------
1
3
2

解决方案 »

  1.   

    order by decode('radio1_1', 'radio1_1', RELY_NO desc, 
    'radio1_2', TORIHIKI_NAME, 'radio1_3', TANTONAME_E, TANTONAME_J),
    这样用是不合适的,违反了decode的使用方法,如果要根据楼主根据不同的radio1_1值排序,可以参照楼上的写函数的方法.
      

  2.   

    decode返回的是函数值,不能把order by 子句中的DESC 也包括进去,你这种写法是想组合SQL语句,但肯定不行。一般这种需求都这么做:
    order by decode(col,'asdfsd',1,'asdfede',2,col)也就是按照你期望的顺序,转换成数字来排序