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 -> How to find single record in ODBC?

How to find single record in ODBC?

From: Garry Star <no-spam.gstar_at_iname.com>
Date: 2000/04/18
Message-ID: <816L4.561$OG4.172682@dfiatx1-snr1.gtei.net>#1/1

There MUST be a simpler way!

I am trying to come up with the SQL to use (via ODBC) to select a single record out of a table. I need the first record that meets my WHERE but I need to have the table ORDERed BY one of the fields (Priority). .

The goal is having 2 or more applications reading and processing records in my table which is being used as a queue. I want the highest priority record that
hasn't been 'taken' by another application. Of course I want to minimize locking. My plan is to select a single (read only) record that meets my criteria and get it's RecordNumber. Then use that RecordNumber as the key to update the record (only locking a single record).

My best shot so far is:

I create a view since it seems you can't use ROWNUM to get the first record of an ordered list.

Are there better ways to do this? Any in standard SQL that will work on other DBs as well (Sybase, SQL Server, Access)?

Thanks...

Garry
garry_star_at_ads-associates.com Received on Tue Apr 18 2000 - 00:00:00 CDT

Original text of this message

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