SQL/MP Programming Manual for C
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for C—429847-008
10-11
Input Parameters and Output Variables
Determining Character Set IDs From the precision Field
Table 10-6 describes the character-set values that NonStop SQL/MP returns to the
SQLDA precision field for CHAR and VARCHAR data types and the character-set
declarations in the sqlh file that you can use in a C program:
For CHAR and VARCHAR parameters and variables, the precision field contains
the character set ID. When a dynamic SQL statement runs, NonStop SQL/MP checks
the precision field to ensure that the character-set ID matches the expected
character set of the parameter or column, which is determined by the value in
COLUMNS.CHARACTERSET.
If the character sets do not match, NonStop SQL/MP returns an error. However, if the
program expects an unknown character set and the CHARACTERSET value for the
parameter or column indicates a single-byte character set, NonStop SQL/MP does not
return an error.
Input Parameters and Output Variables
A parameter is a name in a dynamic SQL statement that serves as a place holder for a
value substituted when the statement runs. Using a parameter, an SQL statement can
be compiled without the input values. The input values are then substituted when the
statement runs. The syntax for a parameter is shown in the SQL/MP Reference
Manual.
Input parameters are specified in the statement as either a question mark (?) or a
question mark plus a name (?val). An input parameter can appear in an SQL
expression wherever a constant can appear. The program uses the DESCRIBE INPUT
Table 10-6. SQLDA Character-Set IDs
Value Declaration Description
0 _SQL_CHARSETID_UNKNOWN A single-byte unknown character set.
1 _SQL_CHARSETID_KANJI Japanese (same as the Shift-JIS)
12 _SQL_CHARSETID_KSC5601 Korean
101 _SQL_CHARSETID_88591 ISO 8859/1
102 _SQL_CHARSETID_88592 ISO 8859/2
103 _SQL_CHARSETID_88593 ISO 8859/3
104 _SQL_CHARSETID_88594 ISO 8859/4
105 _SQL_CHARSETID_88595 ISO 8859/5
106 _SQL_CHARSETID_88596 ISO 8859/6
107 _SQL_CHARSETID_88597 ISO 8859/7
108 _SQL_CHARSETID_88598 ISO 8859/8
109 _SQL_CHARSETID_88599 ISO 8859/9