Returning record X-Y from a table
Date: Thu, 17 Jul 2003 09:27:59 -0600
Message-ID: <VqxRa.2765$124.13491_at_wagner.videotron.net>
Hi there,
Looking for a way of returning the Xth to Yth records of an Oracle database
I thought using ROWNUM. Here is the solution I came up with.
SELECT * FROM
(
SELECT
ROWNUM RECID,
t.*,
FROM
table t
WHERE
)
(ROWNUM BETWEEN 1 AND Y) AND
(whatever condition you want on your table)
WHERE
RECID >= X
It work great for me so far, but my tables aren't very big (a few thousands
records).
Is anybody aware of any kind of issues using this query as the table get bigger and, if yes, is there any way to optimize this. (They are history tables and will definitely get huge at some point).
I assumed that as this query is processed entirely on the Oracle server the performance sould be better than if I had queried the top Y records and filtered out the top X records on the client side.
Thanks for your advice.
JB Fidelia.
Received on Thu Jul 17 2003 - 17:27:59 CEST