The following example shows the syntax for deleting an object type.

DROP TYPE objtype;

objtype is the identifier of the object type that you want to delete. If the definition of objtype contains attributes that are object types or collection types, these nested object types or collection types must be deleted last.

If an object type body is defined for the object type, the DROP TYPE statement deletes the object type body as well as the object type specification. If you want to recreate the complete object type, both the CREATE TYPE and CREATE TYPE BODY statements must be reissued.

The following example deletes the emp_obj_typ and the addr_obj_typ object types created earlier in this topic. emp_obj_typ must be deleted first because it contains addr_obj_typ within its definition as an attribute.

DROP TYPE emp_obj_typ;
DROP TYPE addr_obj_typ;

The syntax for deleting an object type body, but not the object type specification is as follows:

DROP TYPE BODY objtype;

The object type body can be recreated by issuing the CREATE TYPE BODY statement.

The following example deletes only the object type body of the dept_obj_typ.

DROP TYPE BODY dept_obj_typ;