INFORMIX
Informix Guide to GLS Functionality
Chapter 8: INFORMIX-ESQL/C Features
Home Contents Index Master Index New Book

Using the TRIM Function

When you dynamically execute a SELECT statement, the DESCRIBE statement can return information about the select-list columns at runtime. DESCRIBE returns the data type of a select-list column into the appropriate field of the dynamic-management structure that you use. (For more information, see "Determining the Data Type of a Column" in Chapter 10 of the INFORMIX-ESQL/C Programmer's Manual.)

When you use the DESCRIBE statement on a prepared SELECT statement with the TRIM function in its select list, the data type of the trimmed column that DESCRIBE returns depends on the database server that you use and the data type of the column to be trimmed (the source character-value expression). For more information on the source character-value expression, see the description of the TRIM function in the Informix Guide to SQL: Syntax.

Using TRIM with INFORMIX-SE

For INFORMIX-SE, the DESCRIBE statement returns the same data type as the source character-value expression. When you dynamically execute the following SELECT statement with an SE database server, the DESCRIBE statement returns a data type of SQLCHAR, the same data type as the select-list column, manu_code (the source character-value expression).

Using TRIM with INFORMIX-OnLine Dynamic Server

For INFORMIX-OnLine Dynamic Server, the data type that the DESCRIBE statement returns depends on the data type of the source character-value expression, as follows:

The following SELECT statement contains the manu_code column, which is defined as a CHAR data type, and the cat_advert column, which is defined as a VARCHAR column. When you describe the following SELECT statement with an OnLine database server, DESCRIBE returns a data type of SQLVCHAR for both trimmed columns:

If the manu_code column is defined as NCHAR instead, DESCRIBE returns a data type of SQLNVCHAR for this trimmed column.

Important: The sqltypes.h header file defines the data-type constants SQLCHAR, SQLVCHAR, and SQLNVCHAR. You must include this header file in your ESQL/C source file in order to use these constants. For more information on the sqltypes.h header file, see Chapter 2 of the "INFORMIX-ESQL/C Programmer's Manual."

Using TRIM with INFORMIX-Universal Server

For INFORMIX-Universal Server, the data type that the DESCRIBE statement returns depends on the data type of the source character-value expression, as follows:

Important: TRIM does not support the LVARCHAR data type in Universal Server.
The following SELECT statement contains the manu_code column, which is defined as a CHAR data type, and the cat_advert column, which is defined as a VARCHAR column. When you describe the following SELECT statement with a database server, DESCRIBE returns a data type of SQLVCHAR for both trimmed columns:

If the manu_code column is defined as NCHAR instead, DESCRIBE returns a data type of SQLNVCHAR for this trimmed column.

Important: The sqltypes.h header file defines the data-type constants SQLCHAR, SQLVCHAR, and SQLNVCHAR. You must include this header file in your ESQL/C source file in order to use these constants. For more information on the sqltypes.h header file, see Chapter 2 of the "INFORMIX-ESQL/C Programmer's Manual."




Informix Guide to GLS Functionality, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.