AnnieLab wrote:
In Oracle you can restrict the number of rows returned by specifying
'WHERE
ROWNUM < 10'. Can you do this in DB2 as well?
SELECT ... FROM ... WHERE ... FETCH FIRST 10 ROWS ONLY
Or use the ROW_NUMBER OLAP function:
SELECT ...
FROM ( SELECT ..., row_number() over() AS rn
FROM ...
WHERE ... ) AS t
WHERE rn < 10
Or use a UDF like the "counter" function available in the samples:
SELECT ...
FROM ...
WHERE counter() < 10
--
Knut Stolze
Information Integration Development
IBM Germany / University of Jena