IBM Books

Call Level Interface Guide and Reference

ODBC Scalar Functions

Scalar functions such as string length, substring, or trim can be used on columns of a result sets and on columns that restrict rows of a result set. The ODBC escape clauses for scalar functions is:

    {fn scalar-function}

Where, scalar-function can be any function listed in Appendix D. "Extended Scalar Functions".

For example, DB2 CLI will translate of the following statement:

    SELECT {fn CONCAT(FIRSTNAME,LASTNAME)} FROM EMPLOYEE

to:

    SELECT FIRSTNAME CONCAT LASTNAME FROM EMPLOYEE

SQLNativeSql() can be called to obtain the translated SQL statement.

To determine which scalar functions are supported by the current server referenced by a specific connection handle, call SQLGetInfo() with the SQL_NUMERIC_FUNCTIONS, SQL_STRING_FUNCTIONS, SQL_SYSTEM_FUNCTIONS, and SQL_TIMEDATE_FUNCTIONS options.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]