DROP TRIGGER — remove a trigger
The following syntax drop the trigger defined with function name: DROP TRIGGER [ IF EXISTS ]nameONtable_name[ CASCADE | RESTRICT ] The following syntax is available in Oracle mode, and drop the trigger defined with code block: DROP TRIGGER [schema.]name
DROP TRIGGER removes an existing
trigger definition. To execute this command, the current
user must be the owner of the table for which the trigger is defined.
IF EXISTSDo not throw an error if the trigger does not exist. A notice is issued in this case.
schemaName of the schema containing the trigger. Default: current schema.
nameThe name of the trigger to remove.
table_nameThe name (optionally schema-qualified) of the table for which the trigger is defined.
CASCADEAutomatically drop objects that depend on the trigger, and in turn all objects that depend on those objects (see Section 6.14).
RESTRICTRefuse to drop the trigger if any objects depend on it. This is the default.
Create and
destroy the trigger if_dist_exists on the table
films:
CREATE TRIGGER if_dist_exists after INSERT ON films FOR EACH ROW EXECUTE FUNCTION if_dist_exists_func(); DROP TRIGGER if_dist_exists ON films;
Create and destroy the trigger if_dist_exists_oracle on the table
films:
CREATE TRIGGER if_dist_exists_oracle after INSERT ON films FOR EACH ROW
begin
dbms_output.put_line('hello world!');
end;
/
DROP TRIGGER if_dist_exists_oracle;
The DROP TRIGGER statement in
LightDB is incompatible with the SQL
standard. In the SQL standard, trigger names are not local to
tables, so the command is simply DROP TRIGGER
.
name