Examples

Example 1: Allocate a descriptor called 'NEWDA' large enough to hold 20 item descriptor areas and use it on DESCRIBE INPUT.

  EXEC SQL ALLOCATE DESCRIPTOR 'NEWDA'
    WITH MAX 20;

  EXEC SQL DESCRIBE INPUT STMT1
    USING SQL DESCRIPTOR 'NEWDA';

Example 2: Execute a DESCRIBE INPUT statement with an SQLDA that has enough SQLVAR occurrences to describe any number of input parameters a prepared statement might have. Assume that five parameter markers at most will need to be described and that the input data does not contain LOBs.

  /* STMT1_STR contains INSERT statement with VALUES clause */
    char table_name[201];
  EXEC SQL  PREPARE STMT1_NAME
              FROM :STMT1_STR;

  ... /* code to set SQLN to 5 and to allocate the SQLDA */
  EXEC SQL  DESCRIBE INPUT  STMT1_NAME INTO  :SQLDA;

  .
  .
  .

This example uses the first technique described in Appendix D. SQLDA (SQL descriptor area).