Previous Topic: Column-Name Qualifiers in Correlated ReferencesNext Topic: Host Structures


Host Variables

A host variable is a data item that is referenced in an SQL statement. For information about how to define host variables in the source code:

The term host-variable, as used in the syntax diagrams, shows a reference to a host variable. A host variable in the INTO clause of a FETCH or SELECT statement identifies a host variable to which a value from a row is assigned.

In all other contexts, a host variable specifies a value.

The general form of a host variable reference is:

:host-identifier

The host-variable name must:

  1. Be a valid data name in the host language that is being used.
  2. Be defined as a legal elementary item with an acceptable embedded SQL data type.
  3. Not include any spaces.

An indicator variable must be associated with a host variable if the host variable will become NULL. See Indicator Variables for more information.