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: Multi-query simplification

Re: Multi-query simplification

From: Henk-Jan Visscher <visscher_at_aedius.com>
Date: 1998/01/06
Message-ID: <34B1EBAC.BBBECB64@aedius.com>#1/1

Try something like this:

select data
from table
where a
and b
and rownum = 1
order by decode (c_column, c_value, 2, 0) + decode (d_column, d_value, 1, 0) /

It might work,

Henk-Jan Visscher.

Mike Bongiovi wrote:

> I am querying records containing information about credit card transactions,
> and I only want to find *one* record with this query and no more. Criteria A
> is the customer's credit card number and criteria B is a reference number given
> to the transaction which is not necessarily unique. Criteria C is the date of
> the transaction and criteria D is the dollar amount of the transaction.
>
> The first level query would look like this:
>
> SELECT data FROM table
> WHERE A AND B AND C AND D;
>
> If nothing is found with this query, I must then do:
>
> SELECT data FROM table
> WHERE A AND B AND C;
>
> If nothing is found with this query, I must then do:
>
> SELECT data FROM table
> WHERE A AND B AND D;
>
> Finally, if nothing is found with this query, I must then do:
>
> SELECT data FROM table
> WHERE A AND B;
>
> In general, the query that ultimately is successful will find only one
> record. I only *want* one record, which is why I don't just start with the
> last query. I was wondering if there was some way to simplify this process.
> Remember, I'm looking for precisely one record.
>
> Thanks,
>
> Michael Bongiovi
> NeuralTech, Inc.
> Fairfax, VA
Received on Tue Jan 06 1998 - 00:00:00 CST

Original text of this message

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