View previous topic :: View next topic
|
Author |
Message |
CIS777 Currently Banned New User
Joined: 16 Sep 2005 Posts: 6
|
|
|
|
The following are the only SQL statements contained in program PGMA:
EXEC SQL DECLARE CSR CURSOR FOR SELECT C1, C2, C3, SUM(C4) FROM T1
WHERE C5 = :HV5 AND C6 = :HV6 GROUP BY C1, C2, C3 END-EXEC.
EXEC SQL OPEN CSR END-EXEC.
EXEC SQL FETCH CSR INTO :HV1, :HV2, :HV3, :HV4 END-EXEC.
Which of the following statements correctly describe the result if PGMA is executed multiple times?
A. An SQLCODE -904 is received the second time PGMA executes.
B. An SQLCODE -502 is received the second time PGMA executes.
C. PGMA runs to completion, but an error message is issued stating that the cursor was not closed.
D. The program executes successfully, fetching a row if a qualifying row exists.
E. After PGMA executes once, an SQLCODE 100 will be returned on subsequent executions, since the cursor was never closed and reopened with new host variable values. |
|
Back to top |
|
|
EnjoyMF
New User
Joined: 27 May 2005 Posts: 88
|
|
|
|
if we try to open the curson again with out closing it we get
B. An SQLCODE -502 is received the second time PGMA executes.
logically fetch is done multiple times and then check for sqlcode = 100 then close the cursor in the program
Regards
prasad |
|
Back to top |
|
|
akkoor
New User
Joined: 08 Oct 2005 Posts: 9
|
|
|
|
We should get a -504
for trying to open an already open cursor |
|
Back to top |
|
|
nikyojin
New User
Joined: 05 Oct 2005 Posts: 94
|
|
|
|
The Release parameter value while Bind if specified as Deallocate will automatically close the cursor once the job ends.
Hence
Quote: |
D. The program executes successfully, fetching a row if a qualifying row exists. |
else
Quote: |
B. An SQLCODE -502 is received the second time PGMA executes. |
since the cursor is left open.... |
|
Back to top |
|
|
|