What is the purpose of coding FETCH in a SQL SELECT query?
Explain with an example in Detail?

Answers were Sorted based on User's Feedback



What is the purpose of coding FETCH in a SQL SELECT query? Explain with an example in Detail?..

Answer / guest

FETCH is used to retrieve a specific row from a result set
of the SELECT query and places them into local variables.

Is This Answer Correct ?    2 Yes 0 No

What is the purpose of coding FETCH in a SQL SELECT query? Explain with an example in Detail?..

Answer / anandrao

FETCH will give only the number of rows equal to the number
specified with FETCH from resultset given by query.
e.g. consider ACCOUNT_MASTER table contains 100 rows.
SELECT *
FROM ACCOUNT_MASTER
FETCH FIRST 10 ROWS ONLY.
Will give only first 10 rows of ACCOUNT_MASTER table from
100 rows of ACCOUNT_MASTER table

Is This Answer Correct ?    1 Yes 0 No

What is the purpose of coding FETCH in a SQL SELECT query? Explain with an example in Detail?..

Answer / siri reddy

Inorder to select first n number of rows fetch is used in
conjunction with select statement

Is This Answer Correct ?    1 Yes 1 No

What is the purpose of coding FETCH in a SQL SELECT query? Explain with an example in Detail?..

Answer / akviswa

PS: fetch can be used in select only in case of cursor
select

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

What is a DBRM, PLAN ?

3 Answers  


How can the firstname and the lastname from the emp table be concatenated to generate complete names?

0 Answers  


How is deadlock resolved?

0 Answers  


Shall i use this query to retrieve first 4 records, Select empno, sal from emptbl where empno < 5. like this can we fetch first 100 records?

3 Answers  


Why do chiropractors use drop table?

0 Answers  






What is the SQL query to select, delete and get count of duplicate rows in DB2?

2 Answers  


what's the best lock size that you could use when you create a tablespace?

2 Answers   IBM,


How to resolve the -305 error code in DB2? And also please let me know, how to resolve the db2 error codes.

7 Answers   TCS,


What is an intent lock?

3 Answers  


Differentiate between cs and rr isolation levels? Where do you specify them?

0 Answers  


Give some example of statistics collected during RUNSTATS?

1 Answers  


quary for 1> fetch last record 2> fetch in reverse order 3> fetch last 5 row 4> fetch second last record (their is no primary key) i think concept of count can be use for this in 4th

5 Answers  


Categories