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

Home -> Community -> Usenet -> c.d.o.server -> Re: Simple question ...

Re: Simple question ...

From: Jaap W. van Dijk <j.w.vandijk.removethis_at_hetnet.nl>
Date: Sun, 08 Aug 2004 10:52:54 +0200
Message-ID: <mspbh0penfl44h45vk7g9748p2403joell@4ax.com>


On Sat, 07 Aug 2004 08:15:35 +0200, Sybrand Bakker <gooiditweg_at_sybrandb.verwijderdit.demon.nl> wrote:

>On Fri, 06 Aug 2004 23:25:15 +0200, Jaap W. van Dijk
><j.w.vandijk.removethis_at_hetnet.nl> wrote:
>
>>On Fri, 6 Aug 2004 15:13:24 +0200, "Ernest Morariu"
>><ernest_at_gesora.com> wrote:
>>
>>...
>>>
>>>SELECT myField INTO myVariable FROM myTable WHERE myCondition;
>>>
>>...
>>
>>You could alter this slightly:
>>
>>SELECT MAX(myField) INTO myVariable FROM myTable WHERE myCondition;
>>
>>In case of no records this will yield NULL
>>In case of one record this will yield myField
>>
>>But note: the case of more than one record will now not error.
>>
>>Jaap.
>
>It will also fetch all affected records and conduct an internal sort
>on them. A pretty inefficient solution.

The OP wants to retrieve 1 record, with the possibility that zero records will be retrieved. So in this case 'all affected records' will be one at the most.

Jaap. Received on Sun Aug 08 2004 - 03:52:54 CDT

Original text of this message

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