2 Awesome differences of DB2 Declare Cursor and Describe Cursor

The DESCRIBE CURSOR -statement obtains information about the result set that is associated with the cursor. The information, such as column information, is put into a descriptor.

Use DESCRIBE CURSOR for result set cursors from stored procedures. The cursor must be defined with the ALLOCATE CURSOR statement.

Example 1:

Place information about the result set associated with cursor C1 into the descriptor named by :sqlda1.

EXEC SQL DESCRIBE CURSOR C1 INTO :sqlda1
Advertisements


Example 2:

Place information about the result set associated with the cursor named by :hv1 into the descriptor named by :sqlda2.

EXEC SQL DESCRIBE CURSOR :hv1 INTO :sqlda2

So, the DESCRIBE CURSOR  is a part of Stored procedures

The DECLARE CURSOR statement -defines a cursor. This statement can only be embedded in an application program. It is not an executable statement. It must not be specified in Java.

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.