Dropping user-defined types

If you no longer need a user-defined type, you can drop it.

About this task

You can drop a user-defined type (UDT) using the DROP statement. You cannot drop a UDT if it is used:

  • In a column definition for an existing table or view.
  • As the type of an existing typed table or typed view.
  • As the supertype of another structured type.

The database manager attempts to drop every routine that is dependent on this UDT. A routine cannot be dropped if a view, trigger, table check constraint, or another routine is dependent on it. If Db2® cannot drop a dependent routine, Db2 does not drop the UDT. Dropping a UDT invalidates any packages or cached dynamic SQL statements that used it.

If you have created a transform for a UDT, and you plan to drop that UDT, consider dropping the associated transform. To drop a transform, issue a DROP TRANSFORM statement. Note that you can only drop user-defined transforms. You cannot drop built-in transforms or their associated group definitions.