Deleting Rows Using Views - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
To delete table rows using a view through which the table is accessed, see the following conditions.
  • You must have the DELETE privilege on the view. Also, the immediate owner of the view (that is, the database in which the view resides) must have the DELETE privilege on the underlying object (view or base table) whose rows are to be deleted, and the SELECT privilege on all tables that are specified in the WHERE clause.
  • Each column of the view must correspond to a column in the underlying table. That is, none of the columns in the view can be derived using an expression.
  • The data type definitions for an index column must match in both the view definition and in the base table to which the view refers.

    You can convert the type of a view column (for example, from VARCHAR to CHARACTER), but if that converted column is a component of an index, then that index is not used to delete rows from the base table because the data type of the recast column no longer matches the data type definition for that column in the index.

    The resulting all-AMP, all-row behavior of the delete circumvents the performance advantages for which the index was designed.

  • Any two view columns cannot reference the same table column.
  • The view cannot include a column that contains a range constraint.
  • The expression used to define a view cannot have a data type specified for any column in the view.