15.00 - DELETE DATABASE and Error Tables - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Teradata Database
Release Number
Content Type
Programming Reference
Publication ID
English (United States)

DELETE DATABASE and Error Tables

When you delete a database that contains an error table, the system drops the error table regardless of the containing database for its data table. The system also drops the rows for the error table in the DBC.ErrorTbls system table (see Data Dictionary).

You cannot delete a database that contains a data table with an error table that is contained by another database. Otherwise, the system aborts the request in Teradata session mode or the transaction in ANSI session mode and returns an error to the requestor.

The remedy for this situation is as follows:

1 Find all the error tables that are defined on the tables in the database being deleted by using the following SELECT request:

     SELECT  BaseTblDbName, BaseTblName, ErrTblDbName, ErrTblName
     FROM    DBC.ErrorTblsV
     WHERE   BaseTblDbName <> ErrTblDbName 
     AND     BaseTblDbName = CurrentDBName;

where CurrentDBName is the database name of the database being deleted.

2 Drop all error tables from the list produced by this query.

3 Resubmit the DELETE DATABASE request.