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?
Answer Posted / 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 |
Post New Answer View All Answers
What is the difference between cursor and select statement?
What is meant by union and union all?
What is dbrm? What it contains? When it will be created?
Explain about dbrm.
What is explain in db2?
What is the difference between dbm cfg and db cfg file in db2 ?
What is the role of the data page in the db2 database?
What is difference between isnull and coalesce?
Mention a credible reason why select* is never given preference in an sql program that has been embedded.
What is precompiler in db2?
How to test SQL -911 error while developing COB-DB2 program
Describe major components of db2?
What is blu acceleration in db2?
What are the two types of logging in the db2 database? Explain them.
What is the advantage in De-normalizing tables in DB2?