Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Dynamic Order By Clause
In article <9tgrad02deh_at_drn.newsguy.com>, "Thomas Kyte"
<tkyte_at_us.oracle.com> wrote:
> In article <7e1c2f8c.0111210812.416e524f_at_posting.google.com>,
> prakashcn_at_hotmail.com says...
>> >>Hi, >> >> Can i have a dynamic order by clause, following is my example which is >> in a package >> >> select * from tab1 >> order by columnname_in >> >> columnname_in will have the actual column name giving the >> flexibility of ordering by any column which is in tab1 with out >> hardcoding the column name >> >> Thanks in advance >> -Regards >> Prakash C N
Actually, this is a trick that could have been more easily accomplished by using EXECUTE IMMEDIATE. I understod his question as "Is it possible to use bind variablwes in the ORDER BY clause". The answer to that was "NO". because oracle needs access path (and that includes the use of sort/merge subsystem) at the time of parse operation, which means that it can not be dynamic.
-- Mladen Gogala I love the smell of napalm in the morning. It smells like victory. Apocalypse NowReceived on Wed Nov 21 2001 - 16:05:20 CST
![]() |
![]() |