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

Answer Posted / m4io

It depends
If the cursor needs materialization then it gets executed
on "open cursor" like answer 1 and 2 say.

else
the query for the next row gets executed on each fetch.

Materialization happens f.e. when sorts are used.


You can close a cursor without having sqlcode +100.

Suppose a cics transaction reads a table (1.000.000 rows)
via an index : if only 20 rows are needed it will only
request 20 rows (1 each fetch) and then close the cursor.

In batch : if I get 100 pens and need to distribute them to
the people who requested some in order of date-requested, I
will close cursor as soon as 100 pens are distributed.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you eliminate duplicate values in db2?

677


What is a db2 schema?

753


Is ibm db2 open source?

573


What is the difference between cursor and select statement?

605


How can we retrieve the total number of records in RPG & CLLE?

185






What is the maximum size of a char data type in db2?

578


Explain in detail about buffer manager and its functionalities?

551


Explain how can you do the explain of a dynamic sql statement?

643


What is the role of union all and union

642


What is the difference between spufi and qmf?

631


What are the contents of a dclmgen?

620


How to run db2 command in windows?

631


When a COBOL-DB2 program in PRODUCTION is updating main tables and gone for long run, what have to do?

3109


Where can you declare a cursor in a cobol-db2 program?

596


What is dbrm?

631