Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Ultimate Question: Oracle, MSSQL, Others vs MYSQL LIMIT Statement
Right. However you do order by date in your table, right. This might be
some generated GUID that is stored in a column, an IDENTITY, a
timestamp, or some name.
So semantically you could do the following:
SELECT touched, some_key FROM T WHERE some_predicate;
The result you store in your app, or you keep a scrollable cursor
(server or client side, whatever your product supports). A server side
scrollable cursor may have the advantage that it materializes only on
demand, so you don't get all 30000 hits when you just look at the first
10 and discard the rest.
Now your app can use an outer join on the primary key to do fetches
(sensitive or insensitive).
You can also perform updates using the optimistic locking provided by
your "touched" marker.
(compare the marker on update/delete)
Note that a scrollable cursor on your DBMS may provide all this logic
natively.
Cheers
Serge
-- Serge Rielau DB2 UDB SQL Compiler Development IBM Software Lab, Toronto Try the DB2 UDB V8.1 beta at http://www-3.ibm.com/software/data/db2/Received on Wed Oct 02 2002 - 08:11:14 CDT