Is this the preferred method or the only method? I ask because we are going to need to port an process from SQL Server to DB2 and this is the only thing we did that wasn't SQL92 compliant. I'd prefer not to have to change it, but if necessary we will.
You should remember , with FETCH FIRST n .. , even if the data in your table does not change, DB2 will not gurantee you the same result for every execution of the statement ...
To have a consistent result set, you may consider using ORDER BY ... Another function you can use is row_number() .... Check Birchall's SQL Cookbook (You can find the link in the thread 'Useful DB2 Stuff', the first or the second in the list)
With 'TOP n', if it's also used with an 'ORDER BY' cluase, a consistent result set is guaranteed. Can the 'FETCH FIRST N' cluase also be used in conjunction with an 'ORDER BY' clause to get this same consistency?