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

How do I delete a table in db2?

0 Answers  


What is the syntax for seeing the columns and data types of a table in the db2 database?

0 Answers  


Hi , I am posting some interview ques . what is the use of cursors ? what is the diff between select and cursor ? bith are used for data retrival .. rite?

2 Answers   Deloitte,


What is the self-referencing constraint?

2 Answers  


What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?

0 Answers  






When reorg is used?

0 Answers  


Which isolation level provides highest data integrity?

0 Answers  


How do you check for a null value in a db2 column?

2 Answers  


In cobol+DB2program if the code of cobol program has changed than i have to do precompilation once again?

6 Answers   TCS,


What are the various data types available in db2?

0 Answers  


What is filter factor?

2 Answers  


Where can you declare a cursor in a cobol-db2 program?

0 Answers  


Categories