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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

List down the types of triggers in the db2 database?

592


What does db2 stand for?

598


What is rct?

751


How does db2 sample database connect?

572


Define predicate?

644






How to take backup of table in db2?

601


How would you find out the total number of rows in a db2 table?

579


How can you count the number of rows from a table tab?

637


Which component is responsible for processing sql statements and selecting access paths?

671


What is host variable?

597


What is db2 bind process?

757


Is ibm db2 open source?

586


How to find schema of a table in db2?

572


What is bind and rebind in db2?

650


What is the default page size of buffer pools?

648