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 kind of database is db2?

0 Answers  


Before you give the explain statement, what are the prerogatives?

0 Answers  


have 3 tables table1, table2 and table3 which contains employee information. table1 is master table, table2 contains emp details like emp no and so on, table 3 contains emp salary. so if any emp leave company between 25th - 30th of every month it has to get updated in tables. but it is not getting updated. What is the reason.

0 Answers  


How to get Top 10 Salaries from a Table

11 Answers   Accenture, HTC,


how to resolve -811 error. give clear explination

4 Answers   IBM,


What is the difference between nvl and coalesce?

0 Answers  


WHAT IS NULL INDICATOR ? WERE IS THIS USED? AND IF IT IS USED IN FILES CONCEPT? HOW DO WE USE IT?

2 Answers   IBM,


What is image copy?

1 Answers   Virtusa,


Define db2.

0 Answers  


What happens to the PLAN if index used by it is dropped?

1 Answers  


What is a collection in db2?

0 Answers  


What does db2 stand for?

0 Answers  


Categories