Use DROP TYPE to delete an object type from PolarDB for Oracle.
Syntax
DROP TYPE objtype;To delete only the object type body without removing the object type specification:
DROP TYPE BODY objtype;Parameters
| Parameter | Description |
|---|---|
objtype | The identifier of the object type to delete |
Behavior
Deleting an object type with nested dependencies
If objtype contains attributes that are object types or collection types, delete those nested types last — after deleting the type that references them.
Deleting both the specification and body
DROP TYPE removes both the object type specification and its body (if one exists). To recreate the complete object type afterward, reissue both CREATE TYPE and CREATE TYPE BODY.
Deleting only the body
DROP TYPE BODY removes the object type body while leaving the specification intact. Recreate the body by reissuing CREATE TYPE BODY.
Examples
Drop two types with a dependency
emp_obj_typ contains addr_obj_typ as an attribute, so emp_obj_typ must be dropped first:
DROP TYPE emp_obj_typ;
DROP TYPE addr_obj_typ;Drop only an object type body
Drop the body of dept_obj_typ without removing its specification:
DROP TYPE BODY dept_obj_typ;What's next
To recreate a complete object type after dropping it, use
CREATE TYPEfollowed byCREATE TYPE BODY