How can I create a trigger that prevents column delete, data deletion and table truncate in the same time?
-
31-12-2020 - |
Question
Having written this trigger create:
CREATE OR REPLACE TRIGGER PROTECT_DB BEFORE DROP OR TRUNCATE ON X.SCHEMA
How can I "add" a DELETE
in the trigger definition ? (the DELETE
should prevent data deleting from tables and column erasing).
Solution
You can't. Look at the docs. In the syntax diagrams note, that there is no way from the ddl_event/OR
loop to get to dml_event_clause
.
And it wouldn't make any sense either. On what table should that trigger fire? DDL trigger don't have tables as targets.
Use two separate triggers.
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange