Structured Types Editor (IBM DB2 LUW)

From DBArtisan
Jump to: navigation, search

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

The Structured Types Editor lets you manage the attributes, methods and body for a structured type.

To edit a structured type

  1. Open an editor on the structured type. For details, see Opening an Object Editor.
  2. Use the following table as a guide to understanding and modifying the settings on the tabs of this editor:
Tab Settings and tasks

Properties

Displays the initially-defined values for the following properties: Instantiable, Final Type, With Function Access, Without Comparisons, Inline Length, Supertype Schema, Supertype Name, Cast (Source as Ref) With, Cast (Ref as Source) With, Reference Using, Size, Precision, and Scale. For details on these properties, see Structured Types Wizard (DB2 LUW).

Attributes

Displays the currently defined attributes for the structured type. Optionally, take one of the following actions:

Select an attribute and change the Datatype in the Property/Value list. Depending on the datatype you choose you can also provide additional datatype options. For details on option availability, see Structured Types Wizard (DB2 LUW).

Add an attribute by clicking the New button and typing a name for the attribute.

Select an attribute and click Drop to delete the attribute.

Methods

This tab lets you initiate creation of method specifications and prepopulate associated method bodies. On opening, this tab lists all method specifications associated with the structured type and for each method, includes name and language details. Optionally, take one of the following actions:

Click Add to begin the process of adding a new method specification. Similarly, select a method and click Edit to modify the method specification. For more information, see Adding or editing structured type methods.

Select a method specification and click Drop to delete that method specification from the structured type.

The Create Body and associated controls are available for selected methods for which no method body has yet been defined. They lets you prepopulate the method body definition: External name - lets you provide a ‘string” or SQL identifier for a method specified with a Language of C, JAVA, or OLE. Transform group - lets you specify the transform group used when invoking the method. This setting is available for methods specified with a Language of C, JAVA, or OLE. As identifier - This setting is available for methods specified with a Language of C. When this check box is checked, the method body is created with the external name as provided. Otherwise, the external named provided will appear within quotes in the CREATE METHOD statement on the Body tab. Inherit isolation level with lock request - specifies whether the INHERIT clause is specified as INHERIT ISOLATION LEVEL WITHOUT LOCK REQUEST or INHERIT ISOLATION LEVEL WITH LOCK REQUEST. This setting is available for methods specified with a Language of SQL. After specifying options, click Create Body to work with the CREATE METHOD statement you generated on the editor’s Body tab.

Body

Lets you view and modify the CREATE METHOD statement generated with your choices on the Methods tab.

DDL View

For details on using this tab, see Viewing the SQL/DDL for an Object.

3. When finished, you can submit your changes. For details, see Previewing and Submitting Object Editor Changes.

Adding or editing structured type methods

The Add Method and Edit Method wizards let you work with the methods of a structured type. They let you specify basic properties, parameter and return value details for methods.

To add or edit a structured type method:

  1. Open an editor on a structured type. For details, see Opening an Object Editor.
  2. Navigate to the Methods panel, and then open a wizard using one of the following techniques:
    • Click Add to create a new method
    • Select an existing method and click Edit.
  3. Use the following table as a guide to understanding and modifying the settings on the tabs of this wizard:
Tab Settings and tasks

Properties

When adding a method this pane lets you specify a Name, Specific Name, Language (OLE, SQL, JAVA, C), and SQL Access Level (CONTAINS SQL, READS SQL DATA, NO SQL). When editing a method, these properties are for display only.

Advanced (available after clicking the Advanced button on the Properties pane)

Lets you select or enable the following ADD METHOD options: Deterministic, External Action, Called on NULL Input, DBINFO, Fenced, Allow Parallel, Scratchpad, Scratchpad Length, Parameter Style (SQL, DB2GENERAL), and Final Call.

Parameters

Lets you work with input parameters:

Add a parameter by clicking the New button and typing a name for the parameter.

Select a parameter and change the Datatype in the Property/Value list. Depending on the datatype you choose you can also provide Precision, Size, and Scale options.

Delete a selected parameter by clicking the Delete button.

Order the parameters using the arrow buttons.

Return

Lets you provide details of the return value of the method:

Return Datatype

Lets you specify the base Type of the return value. Depending on the datatype you choose you can also provide Precision, Size, and Scale options.

Cast Datatype

This group lets you optionally use the CAST FROM form of the ADD METHOD RETURN clause. It lets you have the method return a different datatype, cast from the datatype specified in the Return Datatype group. This feature must be Enabled and provide the same type options as the Return Datatype group.

An As Locator option specifies that the method return a LOB locator instead of the actual value. The option is only available for LOB and LOB-based datatypes. As Locator applies to a LOB type in the Cast Datatype group, if specified. Otherwise it applies to a LOB type in the Return Datatype group

4. When ready click Finish.