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

Explain about mirror activator disk mirroring?

655


Are view updateable?

710


What is phantom read in db2?

720


What is null indicator in cobol db2?

674


What is the maximum size of varchar data type in db2?

718






What is a dbrm in db2?

660


what is the responsibility of the construction superintendent

1744


Why do we need reorg in db2?

642


What are host variables in db2?

707


What is universal database?

716


What are the full forms of spufi and dclgen and why are they used?

734


How can you do the explain of a dynamic sql statement?

719


Which isolation level provides highest data integrity?

675


How do I delete a table in database?

690


What is reorg?

694