what is the use of cursors?

Answers were Sorted based on User's Feedback



what is the use of cursors?..

Answer / bala

If the query inside the program retrieves only one row, there is no need to CURSOR.
If the program has to process the multiple rows that are retrieved by the query,
CURSOR is needed. Because, host variables can accommodate data from only one row at a time. By Declaring the cursor, multiple rows can be fetched one at a time and assign it to host variables for processing.

Is This Answer Correct ?    9 Yes 0 No

what is the use of cursors?..

Answer / guest

Cursors are used for providing multiple rows to process in
host language by fetching one row at a time.

Is This Answer Correct ?    7 Yes 0 No

what is the use of cursors?..

Answer / siri

it is use to retrive more than one row for an sql query return in application program....with out using cursors then it abbends with an sql code -811...

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More DB2 Interview Questions

How do I import data from excel to db2?

0 Answers  


Q1. How will you use two different DB2 qualifiers in a single COBOL program? Suppose we have 2 tables EMP1 and EMP2 with same structure defined in two different DB2 qualifiers QUAL1.EMP1 and QUAL2.EMP2 now during first 15 days we want to use QUAL1.EMP1 and rest of the days QUAL2.EMP2  how will we do this.  We can create a single program and a single load for this program. 

2 Answers   RBS,


Give the COBOL definition of a VARCHAR field.

2 Answers  


What are the functions in DB2?

3 Answers   Satyam,


what's the error code for Unique Index Violation?

2 Answers  






How do I add a column to an existing table in db2?

0 Answers  


What do you mean by between and in? Is between inclusive of specified range values?

0 Answers  


Why do we need reorg in db2?

0 Answers  


What is dbrm? What it contains?

0 Answers  


What is db2? Explain.

0 Answers  


in the CURSOR declare statement, if i am using an where clause and trying to compare the value with a host-varialble. EXEC SQL DECLARE C1 CURSOR FOR SELECT DEPTNO, DEPTNAME, MGRNO FROM DEPARTMENT WHERE ADMRDEPT = :ADM-DEPT Where would i need to provide value to this host-variable in the where clause. how could i pass value to this host-variable to check it.

2 Answers   iGate,


What is the purpose of the SDSNLOAD dataset in the STEPLIB while running DB2 programs?

2 Answers  


Categories