Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: mixing dynamic native sql and static sql?
On 12 Apr 2002 02:16:24 -0700, plm_at_gmx.li (Peter Mutsaers) wrote:
>Hello,
>
>I need to parametrize the ordering from a large query.
You can use something like
ORDER BY DECODE(test_expression, case1, column1, case2, column2, case3, column3, ...)
to evaluate a complex condition and substitute the appropriate column to order by in each case. The expression might be a function that performs an arbitrary number of tests. Don't know how well this performs on a large result set or whether it's practical to make a function-based index on the entire DECODE() or just the expression being evaluated.
John
-- Got an Oracle database question? Try the search engine for the database docs at: http://tahiti.oracle.com/Received on Sat Apr 13 2002 - 00:40:17 CDT