从plsql过程参数设置'Order By'子句

hay*_*eld 4 sql oracle plsql

从传入plsql过程的参数动态设置'order by'列名称和方向的最佳方法是什么?

And*_*mar 11

如果您使用案例订购,则可以使用变量:

select  *
from    YourTable
order by
        case when par_name = '1' then col1
             when par_name = '2' then col2
        end
,       case when par_name = '3' then col3
        end desc
Run Code Online (Sandbox Code Playgroud)