When is the results table for the query in a DECLARE CURSOR
statement created?
Answers were Sorted based on User's Feedback
Answer / biswamoy
You can Declare Cursor either in Working-storage section or
in Procedure division. It is not executable
OPEN CURSOR is executable ( here it creates Result), Fetch
rows within loop then close cursor.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shailendra
cursor
declare cursor : it is not exectable statement it take
place in working storage section,it just keep the cursor
on that place where the condition is satisfied which is
define in the quary.
executable statement define in procedure division:
1> open cursor : it define now which cursor open to retrive
data, we can define many cursor at a time.
2> fetch cursor:this statement fetch the record which is
satisfy the condition
3> close cursor : it close the cursor
now if we want to fetch the same record again then it must
to go through open cursor statement again.
| Is This Answer Correct ? | 2 Yes | 3 No |
Answer / mani
the first one is correct i.e. when the open cursor statement
gets executed, the results table is created for the query in
declare cursor statement.
after that when fetch is done it is actually retrieved one
by one from the results table.
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / mehdee
It is not OPEN CURSOR is executed, it is the 1st FETCH.
| Is This Answer Correct ? | 0 Yes | 1 No |
Which component is used to execute the sql statements?
Plan is an executable form of sql statements,But what exactly resides inside a Plan. what are the details inside Plan.
What is the SQL Communications Area and what are some of its key fields?
How to select the duplicate rows from a table?
Shall i use this query to retrieve first 4 records, Select empno, sal from emptbl where empno < 5. like this can we fetch first 100 records?
how to copy the host variables from ps file into cobol program other than include statement
Suppose we have a query for update update table1 set col1 = 'val1' where col2=(select .... from ...) suppose the subquery does not return any record, what will happen to update?
Is it possible to update a primary key value? If not, what is the error code given? If yes, can more than 1 primary key column be updated at a time?
If we keep the DCLGEN structure for a table in a copybook and include it in the COBOL program using the COPY statement, will there be any impact during compilation or at any stage of program execution?
Explain package in db2 and its advantages?
What is coalesce in db2?
What is correlation names?