Drop a sequence

2023-10-24 09:23:03  Updated

You can use the DROP SEQUENCE statement to drop a sequence. This topic describes how to drop a sequence.

Syntax

DROP SEQUENCE [schema.] sequence_name;

Parameters

Parameter Description
schema. The schema where the sequence to be dropped is located. If schema. is not specified, the sequence to be dropped is located in the schema of the current logged-on user.
sequence_name The name of the sequence to be dropped.

Examples

  1. View the seq1 sequence.

    obclient> SELECT sequence_name,max_value FROM USER_SEQUENCES 
              WHERE SEQUENCE_NAME = 'SEQ1';
    +---------------+-----------+
    | SEQUENCE_NAME | MAX_VALUE |
    +---------------+-----------+
    | SEQ1          |         5 |
    +---------------+-----------+
    1 row in set
    
  2. Drop the seq1 sequence.

    obclient> DROP SEQUENCE seq1;
    Query OK, 0 rows affected
    
  3. View the seq1 sequence again.

    obclient> SELECT sequence_name,max_value FROM USER_SEQUENCES 
              WHERE SEQUENCE_NAME = 'SEQ1';
    Empty set
    

Contact Us