Using DROP TABLE Statement in Oracle

This article is written about how to use the Oracle DROP TABLE declaration with syntax and examples.

Description

The Oracle DROP TABLE announcement lets in you to do away with or delete a desk from the Oracle database.

Syntax

The syntax for the Oracle DROP TABLE assertion is:

DROP TABLE [schema_name].table_name
[ CASCADE CONSTRAINTS ]
[ PURGE ];

Parameters or Arguments

schema_name The title of the schema that owns the table. table_name The identify of the table to dispose of from the Oracle database. CASCADE CONSTRAINTS Optional. If specified, all referential integrity constraints will be dropped as well. PURGE Optional. If specified, the table and its structured objects will be purged from the recycle bin and you will now not be in a position to get better the table. If no longer specified, the desk and its structured objects are positioned in the recycle bin and can be recovered later, if needed.

Note

If there are referential integrity constraints on table_name and you do not specify the CASCADE CONSTRAINTS option, the DROP TABLE statement will return an error and Oracle will not drop the table.

Example

Let’s look at an example that shows how to drop a desk in Oracle through the use of the DROP TABLE statement.

For example:

DROP TABLE customers;

This Oracle DROP TABLE instance would drop the desk called customers.

Purge

Let’s seem to be at how to use the PURGE option with the DROP TABLE announcement in Oracle.

When issuing a DROP TABLE assertion in Oracle, you can specify the PURGE option. The PURGE option will purge the desk and its dependent objects so that they do no longer show up in the recycle bin. The chance of specifying the PURGE alternative is that you will now not be able to get better the table. However, the advantage of the use of PURGE is that you can ensure that sensitive data will no longer be left sitting in the recycle bin.

For example:

DROP TABLE customers PURGE;

This DROP TABLE declaration would drop the table known as customers and problem a PURGE so that the house associated with the customers desk is released. In different words, the clients desk is no longer placed into the recycle bin and, therefore, can now not be recovered later if required.