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 is a DBRM, PLAN ?
How can the firstname and the lastname from the emp table be concatenated to generate complete names?
How is deadlock resolved?
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?
Why do chiropractors use drop table?
What is the SQL query to select, delete and get count of duplicate rows in DB2?
what's the best lock size that you could use when you create a tablespace?
How to resolve the -305 error code in DB2? And also please let me know, how to resolve the db2 error codes.
What is an intent lock?
Differentiate between cs and rr isolation levels? Where do you specify them?
Give some example of statistics collected during RUNSTATS?
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