Use indicator variables in C and C++ applications that use SQL

An indicator variable is a two-byte integer (short int).

You can also specify an indicator structure (defined as an array of halfword integer variables) to support a host structure. On retrieval, an indicator variable is used to show if its associated host variable has been assigned a null value. On assignment to a column, a negative indicator variable is used to indicate that a null value should be assigned.

Indicator variables are declared in the same way as host variables. The declarations of the two can be mixed in any way that seems appropriate to you.

Example

Given the statement:

   EXEC SQL FETCH CLS_CURSOR INTO :ClsCd,
                                  :Day :DayInd,
                                  :Bgn :BgnInd,
                                  :End :EndInd;

Variables can be declared as follows:

  EXEC SQL BEGIN DECLARE SECTION;
  char  ClsCd[8];
  char  Bgn[9];
  char  End[9];
  short Day, DayInd, BgnInd, EndInd;
  EXEC SQL END DECLARE SECTION;
Related reference
References to variables