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

Is the primary key a clustered index?

0 Answers  


Can a primary key have null values? If we try to insert a null value in a primary key column, will it work or give an error code?

6 Answers  


what's the error code for Unique Index Violation?

2 Answers  


What do you mean by storage group (stogroup)?

0 Answers  


What's the maximum number of characters that a tablename can have?

3 Answers  


assume ther are 5000 records in a database and want to fetch using cursor. cursor fetches only 3000 records and fetch is not happening for remaining 2000 records. why it happens and how to rectify it

1 Answers   TCS,


What is a root page?

1 Answers  


What are host variables in db2?

0 Answers  


what is rebinding ?

1 Answers   IBM,


What is the function of buffer manager?

1 Answers  


Shall i use this query to retrieve first 4 records, Select empno, sal from emptbl where empno < 5. like this can we fetch first 100 records?

3 Answers  


if suppose i am having an ACCOUNT table with 3 coloumns ACC. NO,ACC. NAME,ACC. AMOUNT . If a unique index is also defined on ACC.NO and ACC.NAME then write a query to retrieve account holders records who have more than 1 ACC.

8 Answers   Wipro,


Categories