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: Getting the first row from a select

Re: Getting the first row from a select

From: Microsoft News <sbarthes_at_email.msn.com.nospam>
Date: 1998/10/07
Message-ID: <#T8kisl89GA.153@uppssnewspub04.moswest.msn.net>#1/1

Hi,

No, the DAO seek, is the fastest access as it uses indexes and not ful tabel scan. That is why you may have to specify which index you are using. When you issue the seek, it should browse the index using a search algorithm (as indexes are sorted) and return you only the first row.

Anyway, if you have a big table, it is only a matter of writting 3 lines to give it a try. Let me know what it gives for the results.

Stephane
sbarthes_at_msn.com

David Ferguson wrote in message
<#aSvQBg89GA.192_at_nih2naab.prod2.compuserve.com>...
>>'Open the table
>>set rec=db.openrecordset("Company",dbopentable)
>>
>>'Tell the engine you seek using that index
>>rec.index="Company"
>>
>>'Lookup the item
>>rec.seek ">=", WhateverWasEntered
>>
>>'check you found one
>>if not rec.nomatch then
>> 'BINGO, YOU HAVE THE FIRST ONE AND YOU DID NOT BROWSE THE HUGE
 TABLE...
>>endif
>
>
>I am not a VB DAO expert but...I thought the DAO .seek function performed a
>full table search. I believe this would involving reading all of the
>records into the client to scan for the 'WhateverWasEntered' this could
>potentially take a long very long time.
>
>Cheers...David
>
>
Received on Wed Oct 07 1998 - 00:00:00 CDT

Original text of this message

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