Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: order by in reports
I'm fairly new at reports 2.5 also but yes, you can set the order by at
runtime.
The way I've done it is to set a bind variable as a user-defined variable with static values so that a pick list is generated. Then, in the "after form" trigger write a plsql routine to set the bind variable to an order by clause string depending on what is chosen.
In your sql query use a lexical reference by preceding the variable with &.
Example:
user defined variable = orderstring
static choices defined are 'Item' and 'Description'
after form trigger:
begin
if :orderstring='Item' then
:orderstring:='order by item;';
else if :orderstring := 'Description' then
:orderstring := 'order by description;';
end if;
In your query you'd have:
select blah, blah, blah
from blah, blah
where blah, blah
&orderstring
The &orderstring will substitute the contents of orderstring at runtime.
On Thu, 25 Jun 1998 02:27:16 +0200, "c. bretterklieber" <cb357_at_yahoo.com> wrote:
>I'm fairly new to oracle reports; and this is something I need to know:
>
>Is there a possibility to determine the sort order at runtime?
>
>TIA,
>
>cb.
Steve
skondolf_at_hatespam.frontiernet.net
skondolf_at_hatespam.compuserve.com
![]() |
![]() |