Creating Object Types v11

You can use the CREATE TYPE command to create an object type specification, and the CREATE TYPE BODY command to create an object type body. This section provides some examples using the CREATE TYPE and CREATE TYPE BODY commands.

The first example creates the addr_object_type object type that contains only attributes and no methods:

CREATE OR REPLACE TYPE addr_object_type AS OBJECT
(
    street          VARCHAR2(30),
    city            VARCHAR2(20),
    state           CHAR(2),
    zip             NUMBER(5)
);

Since there are no methods in this object type, an object type body is not required. This example creates a composite type, which allows you to treat related objects as a single attribute.

member_methods static_methods constructor_methods