Re: "ORDER BY" problem

From: Bjarne <bjoped_at_online.no>
Date: Sat, 7 Nov 1998 21:54:56 +0100
Message-ID: <722cft$pd3$1_at_readme.online.no>


You could use DECODE, for example: order by DECODE(:param1,'First name',A.fname,'Last name',A.lname),DECODE(:param2,....)

of course depending of what you know of the contens of the parameters.

Zachary Agatstein skrev i meldingen
<71qd51$t0m2_at_tmpsp002.tmpprv.allied.com>...
>In a query inside the Reports, I want to be able to do "ORDER BY" in
>accordance with input parameters. Say, I have a table A with columns named
>'columnA' and 'columnB'. I also have user parameters named 'param1' and
>'param2'. I would like to do the following:
>
>select columnA, columnB
>from A
>order by :param1, :param2;
>
>This presumes of course that the content of each user parameter would be
>'A.columnA' or 'A.columnB'.
>
>What is a correct way to do this?
>
>Thanks
>
>ZAch Agatstein
>
>
>
Received on Sat Nov 07 1998 - 21:54:56 CET

Original text of this message