Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Answers were Sorted based on User's Feedback



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

Answer / s

When you open the cursor the result set is built.

Is This Answer Correct ?    4 Yes 1 No

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

Answer / mna

The process of using cursor is:
1. declare the cursor in working storage: You will write
the SQL query here
2. open the declared cursor : this is when the actual SQL
query is executed and the fetched rows are moved to the
cursor storage.
3. Fetch rows from cursor : Reading rows one by one on the
Cursor just like we read records from a sequential file
4. Close cursor : While fetching if we get an SQLCODE=+100
it is the end of the cursor just like we encounter eof
while reading records from a sequential file. Once this
condition is encountered we will close the cursor.

Is This Answer Correct ?    1 Yes 1 No

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

Answer / 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



More DB2 Interview Questions

DB2 can implement a join in three ways using a merge join, a nested join or a hybrid join. Explain the differences?

0 Answers  


What are the various locks available?

5 Answers   CTS,


What is -904 sql code? How to resolve it?

3 Answers  


how do you resolve -818 error in db2. where we have to see time stamp token. i said by seeing in load module and plan .is it correct or not. give clear explination for how to see time stamp token

2 Answers   IBM, TRD,


Lot of updates have been done on a table due to which indexes have gone haywire. What do you do?

2 Answers  






What does db2 mean?

0 Answers  


What is reorg and runstats in db2?

0 Answers  


What are db2 tables?

0 Answers  


Assuming that a site's standard is that pgm name = plan name, what is the easiest way to find out which Will precompile of an DB2-COBOL program bomb, if DB2 is down?

1 Answers  


What is the use of reorg in db2?

0 Answers  


What's the Maximum Length of SQLCA and what's the content of SQLCABC?

2 Answers  


What is bufferpool in db2?

0 Answers  






Categories