What is the syntax required for the creation of a cursor?



What is the syntax required for the creation of a cursor?..

Answer / prasad

Example For cursor Syntax:

Declare Cursor:

EXEC SQL DECLARE CUST_ITM CURSOR
FOR
SELECT
OWN_CUS_NO,

OWN_CUS_ITM_SUF_NO
FROM
NPJXTII
WHERE SCK_NO = :SCK-
NO
AND SCK_DT = :NPS-ORIG-TRANS-
DT

AND SCK_LN_ITM_SEQ_NO = :SCK-LN-ITM-SEQ-
NO

END-
EXEC.

Open Cursor:

EXEC SQL OPEN CUST_ITM
END-EXEC.

Fetch Cursor:

EXEC SQL FETCH CUST_ITM
INTO :OWN-CUS-NO,
:OWN-CUS-ITM-SUF-NO
END-EXEC.


Close Cursor:

EXEC SQL CLOSE CUST_ITM
END-EXEC.

Is This Answer Correct ?    12 Yes 1 No

Post New Answer

More DB2 Interview Questions

What are db2 tables?

0 Answers  


How to test SQL -911 error while developing COB-DB2 program

1 Answers   Satyam,


How does one bind 2 versions of a CICS transaction with the same module name in two different CICS regions that share the same DB2 subsystem?

2 Answers  


What are the contents of a DCLGEN?

4 Answers   MetLife,


What is the picture clause of the null indicator variable?

6 Answers  






How to resolve -803 sql code in DB2?

3 Answers   Cap Gemini,


What is the meaning concurrency in the db2 database?

0 Answers  


What is null value in db2?

0 Answers  


How to resolve the -305 error code in DB2? And also please let me know, how to resolve the db2 error codes.

7 Answers   TCS,


How can record locking be achieved in those DB2 versions which do not support it?

0 Answers  


What is a correlated sub query?

2 Answers  


What is a DB2 plan?

8 Answers  


Categories