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

Why cursor is used in db2?

1 Answers  


In which column of which DB2 catalog would you find the length of the rows for all tables?

2 Answers  


Mention the definition of cobol in varchar field.

1 Answers  


What technique is used to retrieve data from more than one table in a single SQL statement?

9 Answers   CTS, IBM, TCS,


If the base table underlying a view is restructured, eg. attributes are added, does the application code accessing the view need to be redone?

2 Answers  


What is the difference between a package and a plan?

6 Answers   Infosys, L&T, Mphasis,


how to u check the query is executing or not ?where will u check for sqlcode ?

6 Answers   Infosys,


What is the SQL Communications Area and what are some of its key fields?

1 Answers  


How many types of page locks can be held in db2?

1 Answers  


how can i pull up a query which was previously stored in qmf

3 Answers  


How do I optimize a query in db2?

1 Answers  


What if we fail to give values in columns declared as NOT NULL ?

3 Answers   Cap Gemini,


Categories