Here’s Difference Between Describe Vs. Declare Cursor in DB2

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.

DESCRIBE

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 

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.

DECLARE

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.

Related posts

Discover more from Srinimf

Subscribe now to keep reading and get access to the full archive.

Continue reading