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



Hi , I am posting some interview ques . what is the use of cursors ? what is the diff between s..

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

Hi , I am posting some interview ques . what is the use of cursors ? what is the diff between s..

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

Post New Answer

More DB2 Interview Questions

My sql statement select avg(salary) from emp yields inaccurate results. Why?

0 Answers  


when does the SQL statement gets executed when you use cursor in the application programming ?

3 Answers   IBM,


How do you define a correlated name?

1 Answers  


What is difference between alias and synonym in db2?

0 Answers  


what's the equivalent Cobol Data type for Decimal(x,y) in DB2? what does the current SQLID register contain?

3 Answers   Cap Gemini, Tech Mahindra,






How many clustering indexes can be defined for a table?

2 Answers  


what is contained in the DB2 node lock file? A) data base names B) data base users names C) license keys D) server names

5 Answers   Accenture,


What are catalog tables in db2?

0 Answers  


Describe major components of db2?

0 Answers  


What is bind and rebind in db2?

0 Answers  


If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?

0 Answers  


Name the different types of Table spaces.

5 Answers   IBM,


Categories