How will fetch last 5 rows from table in db2

Answer Posted / vaneeshh khurana

See there is no direct method to do so, but still if we want
last 5 rows only we can create a logic which is as follows.

1. Declare an array to save the fetch rows with occurs of 5.
2. Now fetch the rows and start saving in that array such
that when the count becomes 5 overwrite the 6th fetch in the
first occurs similarly the 7th fetch on the 2nd occur.
3. Now when all the fetching is done the array will contains
the last 5 fetched rows.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about rct.

646


What is runstats utility in db2?

569


What is db2 bind process?

753


What is the difference between db2 and oracle?

673


What is dbrm library?

578






What happens in bind step in a db2 program?

565


What is sqlca?

618


Define db2 and its databases?

618


What are the full forms of spufi and dclgen and why are they used?

654


What are the contents of a dclmgen?

628


What are the rules for db2 programming?

641


How can you quickly find out the # of rows updated after an update statement?

631


What is load utility in db2?

665


What is the use of value function?

622


How to run db2 command in windows?

643