DROP TABLE

 

Function

The statement removes a base table, all dependent views and all data.

Note: Dropping a table causes all the data contained within to be destroyed. Once the statement has been executed, there is no way to recover the data.

 

Syntax

drop_table.bmp
 

table_specification

The expected format is catalog . schema . table identifier. The default schema and catalog is assumed if omitted.  See Table Specification.

 

Description

A table and all associated information will be deleted from CONNXs catalog and the underlying Adabas file will be deleted. Any other statements referencing this table will no longer be valid. In addition, any attempts to compile statements which reference this table will fail. Even if the table is re-specified, all previously compiled statements remain invalid.

  • If the CASCADE option is specified, all view descriptions based on the table to be dropped, will be deleted. Statement execution will be rejected if attempts are made to drop a table with dependent views but without the CASCADE option.

  • If the statement is invoked statically, then during pre-compilation, the schema need not exist in the catalog. For successful execution, however, the schema must be existent in the catalog, regardless of how it is invoked.

Limitations

The DBA can execute this statement for all users. All other users can use this statement only in a schema owned by the user.

The specified table specification must denote an existing table at runtime.

If a table has been created as a part of a cluster, then it can not be dropped individually. The cluster must be dropped in order to remove this table.

Caution: This statement is not subject to transaction logic. An implicit COMMIT will be performed after successful execution of this statement. If an error is detected during execution of this statement, an implicit ROLLBACK will be performed. Therefore, before executing this statement, it is strongly recommended to complete any open transaction containing INSERT, UPDATE and/or DELETE statements by issuing an explicit COMMIT or ROLLBACK statement.

 
ANSI Specifics

Drop Table is part of the ANSI standard.

 

CONNX Specifics

None.

 

Example

The following example drops the table 'cruise' and all dependent views.

 

DROP TABLE cruise CASCADE