Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: order by in reports

Re: order by in reports

From: <bialik_at_wis.weizmann.ac.il>
Date: Sat, 27 Jun 1998 20:29:29 GMT
Message-ID: <6n3kn8$oie$1@nnrp1.dejanews.com>


Hi.
I would suggest another option :
  use the SQL itself ( with DECODE function ):

SELECT ITEM_NO, ITEM_DESCRIPTIOM, ITEM_PRICE FROM ITEM ORDER BY DECODE ( :Parm1, 'ITEM', 1, 'DESCRIPTION', 2, 'PRICE', 3, 1);

   Michael.

In article <3592e0db.1110529_at_news.frontiernet.net>,   skondolf_at_frontiernet.net (Steven C. Kondolf) wrote:
>
> 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
>
> *** email addresses altered to foil spammers !! ***
> *** Remove hatespam. from address before sending ***
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Sat Jun 27 1998 - 15:29:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US