---
title: "trigger"
author: "四书五经"
date: "2013-03-13T16:22:04Z"
tags: []
categories: ["数据库"]
slug: "trigger"
draft: false
lastmod: "2013-03-13T18:53:02Z"
id: 1828791
url: "https://coderanch.iteye.com/blog/1828791"
---

**Triggers** are procedures that are stored in the database and are implicitly run, or []()[]()fired, when something happens.

Traditionally, triggers supported the execution of a PL/SQL block when an `INSERT`, `UPDATE`, or `DELETE` occurred on a table or view

**Trigger’s  type:**

- DML triggers on tables.
- `INSTEAD` `OF` triggers on views.
- Syst[]()[]()em trig[]()gers on `DATABASE` or `SCHEMA`: With `DATABASE`, triggers fire for each event for all users; with `SCHEMA`, triggers fire for each event for that specific user.

System events:

- DML statements (`DELETE`, `INSERT`, `UPDATE`)
- DDL statements (`CREATE`, `ALTER`, `DROP`)
- Database operations (`SERVERERROR`, `LOGON`, `LOGOFF`, `STARTUP`, `SHUTDOWN`)

[http://docs.oracle.com/cd/B19306\_01/appdev.102/b14251/adfns\_triggers.htm](http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm)