Hi ALl,
Is there a way where I can have an Order Clause in a query based on a value?
The reason is that when using the Order clause the query takes to much time. 18 seconds.
Where there is no Order clause the query takes less than a second so I want to load the report without any order and give user the option to select an order if needed.
This is the Order clause:
order by
case :P30_ORDEN
when 'NAME' then lower(c.asegurado)
else null
end,
case :P30_ORDEN
when 'UPDATED' then localtimestamp - c.updated
when 'OLDFIRST' then c.created - localtimestamp
when 'NEWFIRST' then localtimestamp - c.created
else null
end
I have also a value of 'NONE' in the :P30_ORDEN select list item so I would like that when P30_ORDEN is 'NONE' the order clause is not used at all.
Is this posible? that when P30_ORDEN is 'NONE' the order clause is ignored from the query.
Thanks