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


Please Help Members By Posting Answers For Below Questions

What is the difference between cursor and select statement?

816


What is meant by union and union all?

770


What is dbrm? What it contains? When it will be created?

772


Explain about dbrm.

766


What is explain in db2?

756






What is the difference between dbm cfg and db cfg file in db2 ?

1236


What is the role of the data page in the db2 database?

757


What is difference between isnull and coalesce?

789


Mention a credible reason why select* is never given preference in an sql program that has been embedded.

918


What is precompiler in db2?

755


How to test SQL -911 error while developing COB-DB2 program

7060


Describe major components of db2?

833


What is blu acceleration in db2?

800


What are the two types of logging in the db2 database? Explain them.

763


What is the advantage in De-normalizing tables in DB2?

927