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 number of rows in db2 tables?
What is DCLGEN?
What are the benefits of using the db2 database?
What is a root page?
How to resolve deadlock issue
the dd name for ksds is dest1 and what is the dd name for alternate index of ksds ? a.dest b.dest1 c.dest1a d.dd1
What is reorg in database?
what is the use of bind parameter, Replace?
In BIND, isolation level parameter specifies the duration of page lock and ACQUIRE, RELEASE also do almost the same thing. What is the exact difference between the two? Do they work in conjunction while executing SQL queries and obtaining locks?
is it compulsory commitment control in journal?
I have 1000 rows in a db2 table.I want to update first 100 records,How do I do it?
What is a recovery log?