Creating and Editing Object Types

From ER/Studio Data Architect
Jump to: navigation, search

Go Up to Creating and Editing Database Dependent Objects

Types define an abstract data type or object composed of a collection of similar types of data. For example, you can create an object type that defines a full address rather than the pieces of an address, such as city, state and postal code in this case the object type stores the pieces of an address as a single type, in the same location and the full address can be accessed and manipulated as single unit rather than multiple units. You could also use an object type to create a purchase order object that includes a method to sum the cost of all purchased items.

Object types are useful for ensuring uniformity and consistency as they are defined as single encapsulated entity that can be reused in other object types and objects. They also offer flexibility by allowing for the creation of objects that represent real-world situations which is limited in relational objects.

Once created, you can use an object type as a datatype in a table.

You can create the following object types:

  • Incomplete: Specifies no attributes or methods and can be used for circular references such as person - female. It lets the type be referenced before it is complete. Incomplete types can also be used to create types that contain REF attributes to a subtype that has not yet been created. To create such a supertype, first create an incomplete type of the subtype to be referenced and then create the complete subtype after you create the supertype.

A subtype is a specialized version of its direct supertype with an explicit dependency on it. To ensure that subtypes are abandoned after a supertype is dropped, drop all subtypes first; a supertype cannot be dropped until all its subtypes are dropped.

  • Complete: An incomplete type can be completed by executing a CREATE TYPE statement that specifies the attributes and methods.
  • VARRAY: Used to store small sets of related data. For example, if you have ten offices (each one with a different description) at a particular division in your company, you could create a VARRAY of 10 to hold the details of these offices. The values for a VARRAY type must be fixed and known and be small values because they are stored in RAW format.
  • Nested Table: Used when data is repeated for the same entity an unknown number of times and storage is a concern.
  • A combination of complete, varray, and nested table types.

The following database platforms support object types:

  • Oracle 8.x, 9i, 10g, 11g and 12c

Create an Object Type

  1. In the Data Model Explorer, expand the physical Main Model, right-click the Object Types node, and then click New Object Type.
  2. Complete the tabs of the Object Type Editor and then click OK to create the object type.


  • Once you have created the object type, you can edit it by right-clicking the object type you want to change, and then clicking Edit Object Type.
  • The Object Type Editor includes find and replace functionality for working with SQL text strings.

The following describe options that require additional explanation:

Header and Body tab

Enter the SQL to create the object type. The SQL generated from each these tabs will appear in their own SQL blocks.

Description tab

Enter or edit a description for the object type.

Attachment Bindings tab

Bind an external piece of information, or attachment to the object type. You can also remove an attachment from an object, override an attachment binding's default value, or change the position of a bound attachment. To override the value of the attachment you have moved to the Selected Attachments grid, double-click the Value field of the target attachment. ER/Studio Data Architect opens the Value Override Editor or a list depending on the attachment datatype. Attachments are created in the Attachments folder of the Data Dictionary. For more information, see Attaching External Documents to the Data Model.

See Also