Call Level Interface Guide and Reference
In addition to the SQL data types (referred to as base SQL data
types) defined in "Data Types and Data Conversion", new distinct types can be defined by the user. These user defined types
(UDTs) share its internal representation with an existing type, but is
considered to be a separate and incompatible type for most operations. These
UDTs are created using the CREATE DISTINCT TYPE SQL statement.
UDTs help provide the strong typing control needed in object oriented
programming by ensuring that only those functions and operators explicitly
defined on a distinct type can be applied to its instances. Applications
continue to work with C data types for application variables, and only need to
consider the UDT types when constructing SQL statements.
This means:
- All SQL to C data type conversion rules that apply to the built-in type
apply to the UDT.
- The UDT will have the same default C Type as the built-in type.
- SQLDescribeCol() will return the built-in type information. The
user defined type name can be obtained by calling
SQLColAttribute() with the input descriptor type set to SQL_DESC_DISTINCT_TYPE.
- SQL predicates that involve parameter markers must be explicitly cast to
the UDT. This is required since the application can only deal with the
built-in types, so before any operation can be performed using the parameter,
it must be cast from the C built-in type to the UDT; otherwise an error will
occur when the statement is prepared. Refer to "User Defined Types in Predicates" for more information.
For complete rules and a description of user defined types(UDT) refer to
the SQL Reference.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]