Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Order clause conditioned by value

Javier PNov 27 2020 — edited Nov 27 2020

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

This post has been answered by AndyH on Nov 30 2020
Jump to Answer

Comments

Processing

Post Details

Added on Nov 27 2020
16 comments
161 views