Postgres Plus Advanced Server Oracle Compatibility Developer's Guide : 8.2 Creating Object Types

Previous PageTable Of ContentsNext Page

Postgres Plus Advanced Server Oracle Compatibility Developer's Guide

 

8.2 Creating Object Types

The CREATE TYPE AS OBJECT command is used to create the object type specification. The following example creates the addr_obj_typ object type.

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

The following object type specification creates the emp_obj_typ object type. In this example, the addr attribute is defined by the addr_obj_typ object type.

CREATE TYPE emp_obj_typ AS OBJECT (
    empno           NUMBER(4),
    ename           VARCHAR2(20),
    addr            ADDR_OBJ_TYP
);

Previous PageTable Of ContentsNext Page