ODBC has escape sequences and scalar functions that can be used
to avoiding having to code directly to the syntax of a particular DBMS's version
of SQL.
See Microsoft's ODBC specification on how to use escape sequences.
The following ODBC escape sequences are supported by the iSeries™ Access for Windows® ODBC
driver.
Escape sequences:
- d
- t
- ts
- escape
- oj
- call
- ?=call – This escape sequence should be used when trying to take advantage
of the DB2® UDB
for iSeries support
for return values from a stored procedure. The parameter marker will need
to be bound as an output parameter using the SQLBindParameter API. Note,
at this time stored procedures can only return values of type integer.
- fn – This escape sequence is used when using the scalar functions below.
The syntax is { fn scalar_function }.
Scalar functions mapped by the ODBC driver to the DB2 UDB for iSeries SQL
syntax:
- length
- log
- database (Mapped on pre-V5R3 servers only)
- insert (Mapped on pre-V5R3 servers only)
- right (Mapped on pre-V5R3 servers only)
Note: All other scalar functions are supported natively in the DB2 UDB for iSeries SQL
syntax, so no mapping is required.