Drops a specified sequence.
1 – Environment
You can use the DROP SEQUENCE statement: o In interactive SQL o Embedded in host language programs o As part of a procedure in an SQL module or other compound statement o In dynamic SQL as a statement to be dynamically executed
2 – Format
DROP SEQUENCE <sequence-name> --+-+---------------+-+--> | +--> CASCADE --+ | | +--> RESTRICT --+ | | +--> IF EXISTS -+ | +-----------<-------+
3 – Arguments
3.1 – CASCADE
The CASCADE clause specifies that you want SQL to invalidate all objects that refer to the sequence and then delete the sequence definition. If you delete a sequence referenced by a stored routine or trigger with a routine or language-semantic dependency, SQL also marks the affected stored routine or trigger as invalid.
3.2 – IF_EXISTS
Prevents SQL command language from displaying error messages if the referenced object does not exist in the database.
3.3 – RESTRICT
The RESTRICT clause prevents the removal of a sequence definition (the DROP SEQUENCE statement fails) when the sequence is referenced by any other object within the Oracle Rdb database. The RESTRICT clause is the default.
3.4 – sequence-name
An existing sequence name in the database. To specify lowercase characters or characters not in the SQL repertoire, enclose the sequence name in single quotation marks (').
4 – Examples
Example 1: Dropping a Sequence SQL> SHOW SEQUENCE; Sequences in database with filename mf_personnel.rdb EMPID SQL> DROP SEQUENCE EMPID; SQL> SHOW SEQUENCE; Sequences in database with filename mf_personnel.rdb No Sequences Found SQL>