Fujitsu J2X0-1634-01EN Computer Accessories User Manual


 
application program from the database, specify in the indicator variable whether the data to be fetched contains null
values. When storing data specified by the application program in a database, also specify in the indicator variable
whether the data to be stored contains null values. Use an embedded SQL declaration clause to declare the indicator
variable. The declaration format is the same as that for a host variable. When an indicator variable is specified in an
SQL statement, prefix the indicator variable with a colon. However, for indicator variables for C and COBOL
statements, specify indicator variables the same way as for general C and COBOL variables without a colon prefixed.
For C, national-language characters cannot be used for indicator variable names. The data type for indicator variables
must be a data type equivalent to SMALLINT. See Appendix A "SQL Data Types and Equivalent Host Variable Data
Types", for the correspondence between data types and SQL types for each language.
The following is an example of specifying indicator variables:
Example:
In this example, the values for STOCKQTY and WHCODE for the product with ITMNO "215" are
obtained from the STOCK table.
SELECT STOCKQTY, WHCODE INTO :STOCKQTY INDICATOR :STOCKQTY_INDICATOR,
:WHCODE INDICATOR :WHCODE_INDICATOR
FROM STOCKS. STOCK WHERE ITMNO = 215
In this example, the indicator variables in the single row SELECT statement are STOCKQTY_INDICATOR and
WHCODE_INDICATOR. These indicators correspond to STOCKQTY and WHCODE, respectively. Indicator variables
need only be specified as required. For example, an indicator variable can be specified for WHCODE without one
being specified for STOCKQTY.
Table: Column values and values stored in indicator variables lists the values stored in indicator variables based on
the values for fetched columns. The length of the value for the fetched column is L and the length of the receiving
indicator variable is M.
[Table: Column values and values stored in indicator variables]
11