Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: order by (asc and desc)
Try:
BEGIN
IF flag = 1 THEN
SELECT a FROM abc ORDER BY a ASC;
ELSE
SELECT a FROM abc ORDER BY a DESC;
END IF;
END;
HTH,
Brian
Eric Luu wrote:
>
> Hi All,
>
> Is there a way of choosing which ordering to use
> (ascend or descend) depending on a flag.
>
> like:
>
> select a
> from abc
> order by a decode(flag, 1, asc, 2, des)
>
> I can use dynimic query, but too much.
> Any help would be appreciated.
>
> you can email me at
> ericluu_at_hotmail.com
> Thanks
Received on Fri Nov 05 1999 - 07:46:20 CST