Home | Previous Page | Next Page   IBM Informix ESQL/C Features (ESQL/C) >

Using the TRIM Function

When you dynamically execute a SELECT statement, the DESCRIBE statement can return information about the columns in the select list of the Projection clause at runtime. DESCRIBE returns the data type of a select-list column in the appropriate field of the dynamic-management structure that you use.

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 IBM Informix: Guide to SQL Syntax.

The data type that the DESCRIBE statement returns depends on the data type of the source character-value expression, as follows:

Dynamic Server

TRIM does not support the LVARCHAR data type.

End of Dynamic 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 and use the TRIM function, DESCRIBE returns a data type of SQLVCHAR for both trimmed columns:

SELECT TRIM(manu_code), TRIM(cat_advert) FROM catalog;

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. To use these constants, include this header file in your ESQL/C source file.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]