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 is cursor in dbms?

0 Answers  


What are the uses of db2 optimizer?

0 Answers  


EXPLAIN has output with MATCHCOLS = 0. What does it mean?

2 Answers  


What is a Database Request Module(DBRM)?

4 Answers  


What is db2 plan table?

0 Answers  






Explain how can you do the explain of a dynamic sql statement?

0 Answers  


What is the maximum number of tables that can be stored on a Partitioned Table Space ?

1 Answers   IBM,


What is error -818 in db2. where can you find the timestamp of the DBRM and the source code.( precompile puts the timestamp on dbrm and source code correct?)

2 Answers  


What is reorg?

0 Answers  


How do you define a correlated name?

1 Answers  


What is image copy in db2?

0 Answers  


How to execute stored procedures?

0 Answers  


Categories