Specifying A Declare Section - HP NonStop SQL/MP Programming Manual

For c
Table of Contents

Advertisement

2
Host Variables
A host variable is a data item you can use in both C statements and NonStop SQL/MP
statements to allow communication between the two types of statements. A host
variable appears as a C identifier and can be any C data item declared in a Declare
Section that has a corresponding SQL/MP data type as shown in
page 2-3 and
Table 2-2
identifier (the left part) of a #define directive.
For static SQL operations, a host variable can be an input or an output variable (or
both in some cases) in an SQL statement. An input host variable transfers data from
the program to the database, whereas an output host variable transfers data from the
database to the program.
(For dynamic SQL operations, input parameters and output variables fulfill the same
function as input and output host variables in static SQL statements.)
An indicator variable is a two-byte integer variable, also declared in a Declare Section,
that is associated with a host variable. An indicator variable indicates whether a
column contains, or can contain, a null value. A null value means that a value is either
unknown for the row or does not apply to the row. A program uses an indicator variable
to insert null values into a database or to test a column value for a null value after
retrieving the value from a database.
Topics include:

Specifying a Declare Section

Coding Host Variable Names
Using Corresponding SQL and C Data Types
Specifying Host Variables in SQL Statements
Declaring and Using Host Variables
Using Indicator Variables for Null Values
Creating Host Variables Using the INVOKE Directive
Associating a Character Set With a Host Variable
Specifying a Declare Section
You declare all host variables in a Declare Section. The BEGIN DECLARE SECTION
and END DECLARE SECTION directives designate a Declare Section. Follow these
guidelines when you specify a Declare Section:
Use the BEGIN DECLARE SECTION and END DECLARE SECTION directives
only in pairs.
HP NonStop SQL/MP Programming Manual for C—429847-008
on page 2-4. However, a host variable cannot be the name or
on page 2-2
on page 2-7
2-1
on page 2-3
on page 2-6
on page 2-17
on page 2-18
on page 2-24
Table 2-1
on

Advertisement

Table of Contents
loading

Table of Contents