So I want to create a trigger or some other kind of method for dropping an entire table if it is created. I have the following SQL query but as of this moment I'm stuck.
CREATE OR REPLACE
TRIGGER `kill_migrations` AFTER CREATE ON SCHEMA
BEGIN
IF SYS.DICTIONARY_OBJ_TYPE = 'TABLE' THEN
DROP TABLE IF EXISTS django_migrations
END;
How do I drop a table if it is created? The current SQL query provided has a syntax error around "Drop Table".
The MySQL manual and the MariaDB manual clearly limit trigger_event_
to INSERT | UPDATE | DELETE
INSERT | UPDATE | DELETE
INSERT | UPDATE | DELETE
. That is, CREATE
is not an option. Note how the error 1064 ... syntax to use near 'CREATE ON ...
points exactly there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.