15.00 - Dropping Attributes From a Structured UDT - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1184-015K
Language
English (United States)

Dropping Attributes From a Structured UDT

Teradata Database automatically removes the associated observer and mutator methods for each attribute that you drop.

The following rules apply to dropping attributes.

  • The specified UDT must be a structured type.
  • The specified UDT must not be referenced by any other database object.
  • An attempt to drop an attribute from a UDT being referenced by some other database object, such as being used as the column data type of any table, the system returns an error to the requestor.

    To be explicit, any of the following conditions cause the request to abort.

  • There is a table in any database for which the data type of one of the columns is the specified UDT.
  • There is a structured UDT for which the data type of one of the attributes is the specified UDT.
  • The specified UDT is referenced in a user-defined cast (see “CREATE CAST/ REPLACE CAST” on page 212).
  • There is a method or UDF in any database that references the specified UDT.
  • There is an ordering or transform group defined for the UDT (see “CREATE ORDERING/ REPLACE ORDERING” on page 416 and “CREATE TRANSFORM/ REPLACE TRANSFORM” on page 694).
  • The attribute to be dropped must not be the only attribute of the UDT.
  • As a UDT developer, you are responsible for performing all the necessary cleanup on all of the following database objects before you drop any attributes from a structured UDT.

  • Casts associated with the UDT.
  • See “CREATE CAST/ REPLACE CAST” on page 212.

  • Orderings for the UDT.
  • See “CREATE ORDERING/ REPLACE ORDERING” on page 416.

  • Transforms for the UDT.
  • See “CREATE TRANSFORM/ REPLACE TRANSFORM” on page 694

  • Tables whose columns are typed with the UDT.
  • See “CREATE TABLE” on page 508

  • Structured UDTs that use the UDT.
  • See “CREATE TYPE (Structured Form)” on page 758

  • UDFs and methods that use the UDT as a parameter type.
  • See “CREATE FUNCTION (External Form)/ REPLACE FUNCTION (External Form)” on page 240 and “CREATE METHOD” on page 403.

    You can drop attributes from a structured UDT definition even if any of the following database objects references the observer or mutator methods associated with that attribute.

  • Cast
  • Macro
  • Stored procedure
  • Trigger
  • View
  • However, when you attempt to execute any of the affected database objects, the system returns an error to the requestor.