Issue
I have an oracle table called for example APP_TABLE
having a sequence SEQ_TABLE
. I want to drop a table with its sequence in a single command.
Note the sequence has been generated through Hibernate (is it a "system-generated" sequence?)
<generator class="native">
<param name="sequence">SEQ_TABLE</param>
</generator>
Does DROP TABLE APP_TABLE
also trigger dropping its sequence in Oracle? I have searched in the documentation (I am using the 19c version) and I have learned all its indices and triggers are removed, but nothing about sequences (the information can be incomplete, though).
How to assure the underlying sequence is also removed without dropping it by explicitly finding out and performing a drop by its name?
Solution
If the sequence is genuinely 'part' of the table definition (in which case it is visibly linked in USER_TAB_IDENTITY_COLS) then it will be dropped. Otherwise it is an independent object and will remain.
Answered By - Gary Myers
Answer Checked By - Marilyn (JavaFixing Volunteer)