Page 1 of 1
DB2 Curosr declaration in procedure division and in WS Section.
Posted: Wed Nov 18, 2015 1:54 pm
by Vijay Chikala
Hi,
If we declare the curosr in procedure division and if we declare it in WS Section, wil lthat make any difference in the two? If yes, what are the differneces.
Re: DB2 Curosr declaration in procedure division and in WS Section.
Posted: Wed Nov 18, 2015 5:11 pm
by Anuj Dhawan
There is no difference in the two as far as the definition of the CURSOR is concerned. If you declare the CUROSR in PROCEDURE DIVISION, the OPEN should logically be done after the DECLARE.
Re: DB2 Curosr declaration in procedure division and in WS Section.
Posted: Thu Nov 19, 2015 11:27 am
by Vijay Chikala
Thanks Anuj. I knew that there is no difference but was not sure about the OPEN statement. Thanks for the clarification.
Re: DB2 Curosr declaration in procedure division and in WS Section.
Posted: Thu Nov 19, 2015 12:19 pm
by Anuj Dhawan
For instance, consider CURSOR as a variable which you'll use in your program. In most of the languages, you can use the variable in the logic of the program later, only if it is declared somewhere before it is used. Same is the case with CURSOR, unless system has its definition, it won't recognize it.
Re: DB2 Curosr declaration in procedure division and in WS Section.
Posted: Thu Dec 31, 2015 2:44 pm
by Vijay Chikala
Anuj Dhawan wrote:For instance, consider CURSOR as a variable which you'll use in your program. In most of the languages, you can use the variable in the logic of the program later, only if it is declared somewhere before it is used. Same is the case with CURSOR, unless system has its definition, it won't recognize it.
You do not find such definitions in book. Thank you!
