Does dropping a table drop its dependent trigger?

2.9k views Asked by At

Dropping a table invalidates dependent objects and removes object privileges on the table. If you want to re-create the table, then you must regrant object privileges on the table, re-create the indexes, integrity constraints, and triggers for the table, and respecify its storage parameters.

I got little confused from this document. It says dropping a table invalidates dependent objects (lets say trigger). So on re-creating the table just re-compiling trigger should be enough to make the trigger valid right? But from doc it says we need to re-create trigger.

Also I tried to a little analysis and found out on dropping a table its dependent trigger is getting dropped (Shouldn't it just get invalidated as per doc)

 create table myteste1 (num int not null primary key);

Table MYTESTE1 created.

 CREATE trigger mytrigger1
 after update on myteste1
 begin
 dbms_output.put_line('mytrigger1 called' );
 end;

Trigger MYTRIGGER1 compiled

SELECT * FROM user_objects where object_name=upper('mytrigger1');

Query Result

Object_name |.....
-------------------
MYTRIGGER1  |......

drop table myteste1;

Table MYTESTE1 dropped.

SELECT * FROM user_objects where object_name=upper('mytrigger1');

Query Result

Object_name |.....
-------------------
0

There are 0 answers