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 |
Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?
If we have 100 records in the PF, we deleted all the records then what is the Size of the PF?
What is the use of commit in db2?
Hi i need to write a query on the following requirement. SELECT COMM_TEXT INTO :WS_MIKM_COMM_TEXT FROM MPIPROD.MIKMV01 WHERE ACCOUNT_NO = :WFD_ACCOUNT_NO AND (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT AND SUBSTR(COMM_TEXT,47,14) = :WS_DENY_DESC) OR (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT) The above query is to be modified. The requirement is if both the fields are equal then that has to be given priority. In the above query if it satisfies any one it comes out without checking if both being equal is possible.
What is multi row fetch in db2?
What is the significance of DB2 free space and what parameters control it?
Explain the function done by data manager?
How to rename a table in DB2 ?
What is the connection string to connect to the DB2 Database ?
What is universal database?
What is a cursor and what is its function?
What is db2 purescale?