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

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to display the return this way?

Re: How to display the return this way?

From: Mark D Powell <mark.powell_at_eds.com>
Date: 14 Dec 2001 12:28:43 -0800
Message-ID: <178d2795.0112141228.3d131019@posting.google.com>

C Chang <cschang_at_maxinter.net> wrote in message news:<3C1A1F19.1421_at_maxinter.net>...
> I have a select script such as:
>
> Select A, B
> from myTable
> where A = 'A1'
> or A = 'D1'
> or A = 'C1'
> or A = 'B1';
>
> How do I let my return display as my order in where clause:
>
> A1 Bxx
> D1 BXXX
> C1 BX
> B1 Byy
>
> but not in sorted order of column A -> A1, B1, C1, D1.
>
> C Chang

There is probably a better answer, but I can think of two possibilities at present:

First, you could write a function to order your data by rules that you determine and call it in an order by clause

or

you could try unioning a series of queries for one value at a time together

select A, B from mytable where A = 'A1'
union all
select A, B from mytable where A = 'D1'
union all
....

Normally you either get the data back in the order that Oracle's access path logic left it in or you specify the desired order using an order by clause.

Received on Fri Dec 14 2001 - 14:28:43 CST

Original text of this message

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