The SQL data types NCHAR and NVARCHAR support locale-specific data, in the sense that the database server uses localized collation (if the locale defines localized collation), rather than code set order, for sorting data strings of these types. For more information about NCHAR and NVARCHAR data types, see Using Character Data Types.
ESQL/C supports the predefined data types string, fixchar, and varchar for host variables that contain character data. In addition, you can use the C char data type for host variables. You can use these four host-variable data types for NCHAR and NVARCHAR data.
Your ESQL/C program can access columns of data types NCHAR and NVARCHAR when it selects into or reads from character host variables. The following code fragment declares a char host variable, hôte, and then selects NCHAR data into the hôte variable:
/* This code fragment declares a char host variable "hôte", which contains a non-ASCII character in the name, and selects NCHAR data (non-ASCII names in the "nom" column of the "abonnés" table) into it. */ EXEC SQL BEGIN DECLARE SECTION; char hôte[10]; ... EXEC SQL END DECLARE SECTION; ... EXEC SQL select nom into :hôte from abonnés where numéro > 13601;
When you declare ESQL/C host variables for the NCHAR and NVARCHAR data types, note the relationship between the declared size of the variable and the amount of character data that it can hold, as follows:
In this case, you must ensure that you declare an ESQL/C host variable large enough to accommodate the number of characters that you expect to receive from the database.
For more information, see The NCHAR Data Type and The NVARCHAR Data Type.
You can insert a value that a character host variable (char, fixchar, string, or varchar) holds in columns of the NCHAR or NVARCHAR data types.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]