In addition to the SQL data types (referred to as base SQL data types), new distinct types can be defined by the user. These user defined types (UDT) share their internal representations with an existing type, but it 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 function and operations explicitly defined on a distinct type an 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:
connection executeSql: 'CREATE DISTINCT TYPE name as VARCHAR(30) WITH COMPARISONS'. connection executeSql: 'CREATE TABLE TEST ( C1 NAME )'. connection executeSql: 'INSERT INTO TEST VALUES ( ''Robert'' )'. result := connection executeSql: 'SELECT * FROM TEST WHERE C1 = NAME(?)' withParameterTypes: (Array with: (UtyDB2VarChar precision: 30)) withParameterValues: (Array with: ''Robert''). result first.