Home > Database > Oracle > How to delete trigger in oracle

How to delete trigger in oracle

WBOY
Release: 2022-05-10 17:26:20
Original
5387 people have browsed it

In Oracle, you can use the DROP TRIGGER statement to delete triggers. The DROP statement is used to perform deletion operations. The function of the DROP TRIGGER statement is to delete the specified trigger. The syntax is "DROP TRIGGER name of the trigger that needs to be deleted;" .

How to delete trigger in oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How to delete trigger in oracle

When a trigger is created in Oracle, sometimes you may need to delete it from the database, then you can use the DROP TRIGGER statement to perform this operation.

Syntax

In Oracle/PLSQL, the syntax for deleting a trigger in Oracle is:

DROP TRIGGER trigger_name;
Copy after login

trigger_name - The name of the trigger to be deleted.

Example

Let’s take a look at an example of how to delete a trigger in Oracle.

DROP TRIGGER orders_before_insert;
Copy after login

This example uses the DROP TRIGGER statement to delete a trigger named orders_before_insert.

Extended knowledge:

Before Delete trigger means that Oracle will fire this trigger before performing the delete operation.

Syntax

The syntax to create a Before Delete trigger in Oracle/PLSQL is:

CREATE [ OR REPLACE ] TRIGGER trigger_name
BEFORE DELETE
   ON table_name
   [ FOR EACH ROW ]
DECLARE
   -- variable declarations
BEGIN
   -- trigger code
EXCEPTION
   WHEN ...
   -- exception handling
END;
Copy after login

Parameters:

OR REPLACE - Optional. If specified, it allows you to re-create an already existing trigger so that the trigger definition can be changed without issuing a DROP TRIGGER statement.

trigger_name - The name of the trigger to create. Before Delete − It means that the trigger will fire before the Delete operation is performed. table_name - The name of the table on which the trigger is created.

Limitations

Before triggers cannot be created on views. Can update: NEW value. Unable to update: OLD value.

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to delete trigger in oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template