SQL/MP Programming Manual for C

Host Variables
HP NonStop SQL/MP Programming Manual for C429847-008
2-6
Specifying Host Variables in SQL Statements
Specifying Host Variables in SQL Statements
Use this syntax to specify a host variable in an SQL statement. You must precede the
host variable name with a colon (:). The colon causes the C compiler to handle the
name as a host variable. To use a pointer as a host variable in SQL statements, place
the colon before the asterisk.
hostvar
is the host variable name; hostvar can be any valid C identifier with a C data
type that corresponds to an SQL data type, but it cannot be on the left-hand side of
a #define directive. Precede hostvar with a colon (:) in an SQL statement.
INDICATOR
is a keyword that must precede indicator_hostvar.
indicator_hostvar
is an indicator variable of type short. Precede indicator_hostvar with a colon
(:) in an SQL statement.
For values returned to a host variable, indicator_hostvar is –1 if the value is
null or 0 if the value is not null. To insert null values into the database, set
indicator_hostvar to a value less than zero.
:hostvar [[ INDICATOR ]:indicator_hostvar ]
[ TYPE AS { DATETIME [ start-date-time TO ] end-date-time }
]
[ { }
]
[ { DATE }
]
[ { }
]
[ { TIME }
]
[ { }
]
[ { TIMESTAMP }
]
[ { }
]
[ { INTERVAL start-date-time }
]
[ { [ ( start-field-precision ) ] }
]
[ { [ TO end-date-time ] }
]