Reputation: 15
Is it possible to automate the creation of triggers in Oracle SQL, like if a drop table
command is ran, not all of your triggers have to be recreated? I didn't find anything online to solve this problem.
Thanks in advance for your answers
Upvotes: 0
Views: 74
Reputation: 50017
Put simply, no. When a table is dropped, everything associated with it goes away, including all indexes, triggers, and etc. If the table is then recreated, all the triggers must be recreated. This is hard-wired into the database, and there's no DDL statement for DROP TABLE XYZ123 EXCEPT FOR ALL THE TRIGGERS WHICH YOU CAN JUST LEAVE FLOATING AROUND IN SPACE UNTIL AND IF THE TABLE IS RECREATED;
As someone else mentioned, you might want to consider using TRUNCATE TABLE
, which blows the data away but leaves everything else intact. Another option is to use a global temp table - see this article at Oracle-Base
Upvotes: 1