I am trying to write a PL/SQL procedure which will have the SQL query to get the results. But the requirement is that the order by can be dynamic and is mainly for sorting the columns in the screen. I am passing 2 parameters to this procedure - in_sort_column and in_sort_order. The requirement is such that on text columns the sorting is in ASC and for numbers it is DESC. My query looks something like this without adding the in_sort_order -
SELECT col1, col2, col3 from tabl e1 where col1 > 1000 ORDER BY decode(in_sort_column,'col1', col1, 'col2', col2, 'col3', col3); I am not able to figure out how to use the in_sort_order parameter in this case. Can someone who has done this before help out ?
Thanks