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 the purpose of coding FETCH in a SQL SELECT query? Explain with an example in Detail?

4 Answers  


Explain the use of the WHERE clause.

2 Answers   IBM,


What are the two types of logging in the db2 database? Explain them.

0 Answers  


a cursor normally gets closed once we provide a commit . If u try to close the same cursor with close cursor command later after providing the commit will there be any sql-error.

3 Answers  


how to check the table is empty or not?

3 Answers   IBM,






List some fields from sqlca?

0 Answers  


i have one file having 100 of records? i want to display it like 20 records in one column and 20 records in another column total 40 records per page ? how ?

2 Answers   EDS,


What is meant by dclgen?

0 Answers  


What is the maximum No of rows per page?

0 Answers   IBM,


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

0 Answers  


What is the difference between static and dynamic SQL?

1 Answers  


How do you define a correlated name?

1 Answers  


Categories