Limiting query results in DB2. Replacing ROWID in Oracle

While working with DB2 tables, many times we may need to limit query results. This is especially true when we just want to test out our queries. If the data volume is huge, the queries can take hell lot of time.

In oracle, the solution is to use ROWID in WHERE clause. In DB2, you can use the construct FETCH FIRST 10 ROWS ONLY. For example,

SELECT * FROM CUSTOMER FETCH FIRST 10 ROWS ONLY;

Leave a Reply