Hi , I am posting some interview ques .
what is the use of cursors ? what is the diff between
select and cursor ? bith are used for data retrival ..
rite?
Answers were Sorted based on User's Feedback
Answer / yuvaevergreen
>>Cursors are memory structures used to handle multiple
rows at a time.
>>Though,select statement can fetch only multiple rows, we
cannot handle multiple rows using host variables.
Basic difference would be single row handling and multiple
rows handling.
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / reddy
cursors are used to retrieve multiple rows . Cussors will
retrieve one row at a time and save the data in the
hostvariables.For retreiving the 2 nd row, we need to
repeat the loop.the same process is continued at the end of
data.
select stmt will retrieve multiple rows at a time. assume
that there are 10 rows in a table.
EX: EXEC SQL
SELECT empno , ename into :hvempno ,:hvename from emp;
END EXEC;
Here the above sql query reults all the 10 rows. But , the
host variables will hold only one row of data.the remaining
9 rows will not be stored any where.
hope this may help u
Is This Answer Correct ? | 4 Yes | 4 No |
What is the difference between group by and order by?
What is with ur in db2?
What is the picture clause of null indicator variable?
How is deadlock resolved?
How do I create a view in db2?
Suppose we have a query for update update table1 set col1 = 'val1' where col2=(select .... from ...) suppose the subquery does not return any record, what will happen to update?
What is Declaration Generator(DCLGEN)?
What techniques will be used to avoid deadlock??
What are the uses of db2 optimizer?
What do you need to do before you do EXPLAIN ?
How do you pull up a query which was previously saved in qmf?
Describe the elements of the SELECT query syntax?