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
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 |
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 |
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 |
Answer / akviswa
PS: fetch can be used in select only in case of cursor
select
| Is This Answer Correct ? | 0 Yes | 0 No |
How to find the maximum value in a column in the db2 database?
what is the role of the cursor in db2?
What is CHECK PENDING ?
What is the clustering index in the db2 database?
What is temporal table in db2?
why db2 is called as universal database?what is the storage capacity of db2v9 n what are the advantages of db2
Suppose I have a program which uses a dynamic SQL and it has been performing well till now. Off late, I find that the performance has deteriorated. What happened?
How to get the ddl of a table in db2?
What is a synonym ?
what is the sqlcode -501
What is load replace in db2?
What is a cursor and what is its function?