DB2 - How FECH FIRST clause works. Give an example.

 Posted by Bandi on 11/30/2013 | Category: Others Interview questions | Views: 2274 | Points: 40
Answer:

The FETCH FIRST clause sets a maximum number of rows that can be retrieved. FETCH FIRST specifies that only integer rows should be made available to be retrieved, regardless of how many rows there might be in the result table when this clause is not specified. An attempt to fetch beyond integer rows is handled the same way as normal end of data. The value of integer must be a positive integer (not zero). The default is 1.
Ex-
SELECT FIRSTNME
FROM EMP
ORDER BY SALARY DESC
FETCH FIRST 5 ROWS ONLY;


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response