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 |
What are the abend codes occour in ur latest PROJECT in DB2
How to find primary key of a table in db2?
Explain about rct.
What is dclgen in db2?
What os does db2 run on?
What is the result of open cursor statement?
What is a db2 cursor?
What does the sqlcode of -818 pertain to?
what is commit & rollback? When and where is used while compiling a cobol-db2 program?
How can record locking be achieved in those DB2 versions which do not support it?
Why do we need to create an alias if we can directly use the table name? What are the benefits of referring a table name by its alias? Also, when should we go for alias and when for synonyms?
What do you need to do before you do EXPLAIN ?