Structured Types Wizard (DB2 LUW)

From DBArtisan
Jump to: navigation, search

Go Up to IBM DB2 for Linux, Unix, and Windows Object Wizards

The Structured Type wizard lets you create the object type specification and define attributes for a structured type. You then use the Structured Type editor to define the methods and body for the type.

To Open the Type Wizard

  1. On the Navigator/Explorer, find the datasource where you want to add the new Structured Type.
  2. Expand the Schema branch, right-click Structured Type, and select Create.
  3. Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
  4. Finally, use the Execute button to create the object.

On completion, the Structured Type editor opens, letting you provide method and body specifications for the structured type. For details, see Structured Types Editor (IBM DB2 LUW).

Structured Types (DB2 LUW) - Properties

When creating or editing a structured type, this tab/panel lets you work with the following settings:

Setting Description

Attributes

Instantiable - if disabled, no constructor function can be generated, nor can a non-instantiable type be used as the type of a table or view. Final Type - enabled, indicates that the structured type cannot be used as a supertype. With Function Access - If enabled, all methods of the type you are creating, and those you will create, can be accessed using functional notation. Some applications prefer functional notation over method invocation. Without Comparisons - If enabled, indicates that there are no comparison functions supported for instances of the structured type. Inline Length - Specifies the maximum size of an instance of a structured type in a column. If the size of a structured type instance is less than the defined maximum, the data is stored inline with the other values in the row. If the size of the structured type is larger than the defined maximum, the structured type data is stored outside of the table (like LOBs).

Supertype

Supertype Schema and Supertype Name - let you designate this structured type as a subtype by providing details of the owning supertype.

Reference

Cast (Source as Ref) With and Cast (Ref as Source) With - Lets you name the cast function, although one will be created with the default name of the structured type you are creating. The cast function “casts” a value between the reference type and the representation type in both directions. Reference Using, Size, Precision, and Scale - Define the built-in data type used as the underlying data type for the structured type you are creating and all its subtypes.

Structured Types (DB2 LUW) - Attributes

For each attribute to be added to the structured type, click the New button, and provide a name for the attribute.

With an attribute selected, you can modify the Datatype. Depending on the datatype you choose you can provide the following datatype qualifiers:

  • Width (decimal only)
  • Scale (decimal only)
  • Size (blob, character, clob, dbclob, graphic, varchar, vargraphic only)
  • Allow log (blob, clob, dbclob only)
  • Allow compact (blob, clob, dbclob only)
  • For bit data (character, long varchar, varchar, only)