Online Documentation for SQL Manager for DB2

Creating/editing UD type


Use the Edit tab of UD Type Editor to create/edit a user-defined type and specify its definition.

 

UD Type Editor - Editing UD Type definition

 

 

Name

Enter a name for the new user-defined type.

 

Schema

Use the drop-down list to select the schema for the UD type.

 

Subtype

This drop-down list allows you to select the object subtype.

 

Depending on the Subtype list selection the different set of options will be available below.

 

Distinct

A distinct type is a user-defined data type that shares its internal representation with an existing type (its "source" type), but is considered to be a separate and incompatible type for most operations. For example, one might want to define a picture type, a text type, and an audio type, all of which have quite different semantics, but which use the built-in data type BLOB for their internal representation.

 

Use built-in type

Select this mode to create UD type based on a built-in type.

Use the drop-down list to select the built-in data type to be used as the basis for the new user-defined type.

 

If necessary, specify the Size and Scale for the user-defined type.

 

Use anchored type

Select this mode to create UD type based on a type of the selected column.

 

Use the Schema, Object type, Source object and Column drop-down lists to define anchored type.

 

Cursor

A user-defined cursor type with an associated row type is a strongly-typed cursor type; otherwise, it is a weakly-typed cursor type. A value of a user-defined cursor type represents a reference to an underlying cursor.

 

UD Type Editor - Editing Cursor UD Type definition

 

 

Use anchored type

Use the Schema, Object type, Source object and Column drop-down lists to define anchored type.

 

Array

A user-defined array type is a data type that is defined as an array with elements of another data type. Every ordinary array type has an index with the data type of INTEGER and has a defined maximum cardinality. Every associative array has an index with the data type of INTEGER or VARCHAR and does not have a defined maximum cardinality.

 

UD Type Editor - Editing Array UD Type definition

 

 

Use built-in type

Select this mode to create UD type based on a built-in type.

Use the drop-down list to select the built-in data type to be used as the basis for the new user-defined type.

 

If necessary, specify the Size and Scale for the user-defined type.

 

Use anchored type

Use the Schema, Object type, Source object and Column drop-down lists to define anchored type.

 

CheckBox Row of object

Enable the option to create a row type based on the table or view column names and column data types.

 

Array size

This section allows you to define the array type size.

 

Array size can be defined using Integer constant, Data type or Anchored type. Select the needed option within the Get size from drop-down list.

 

Integer constant

If this option is selected, then you need to define array size at the corresponding field.

 

Data type

This option specifies that the type is an associative array that is indexed with values of the selected data type (RadioButton Integer or RadioButton Varchar).

 

Anchored type

Use this option to define the UD array type size within the anchored data type selected below.

 

 

Row

A row type is a data type that is defined as an ordered sequence of named fields, each with an associated data type, which effectively represents a row. A row type can be used as the data type for variables and parameters in PL/SQL to provide simple manipulation of a row of data.

 

UD Type Editor - Editing Row UD Type definition

 

 

Row user-defined type can be based on a set of manually defined fields or an anchored type.

 

RadioButton Define fields

Use the context menu to manage fields. You can btnAddField Insert, btnEditField Edit or btnDeleteField Drop a field.

 

UD Type Editor - Editing Row UD Type definition - Field Editor

 

 

Field type can be defined using a RadioButton built-in type or an RadioButton anchored type.

 

RadioButton Use anchored type

Use the Schema, Object type, Source object and Column drop-down lists to define anchored type on which the row UD type will be based.