What is the best way to dynamically set the 'order by' column name and direction from parameters passed in to a plsql procedure?
You can use variables if you order using a case:
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
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With