Oracle triggers in the detailed

Source: Internet
Author: User

Oracle Triggers Category:

1. Statement triggers

2, row triggers

3. System Condition Trigger

4. User event triggers

5. INSTEAD of Triggers

1. Statement triggers

is a specific statement or a trigger on a statement group that executes on a table or on a view in some cases. The ability to insert, UPDATE,

Delete or associate on a combination. However, no matter what combination is used, the individual statement triggers are activated only once for the specified statement

。 For example, an UPDATE statement trigger is invoked only once, regardless of how many rows are being update.

Example:

Users who perform DML operations on a table need to be checked for appropriate privileges.

Create Table Foo (a number);

Create Trigger Biud_foo

Before insert or UPDATE or delete

on Foo

Begin

If user not in (' DONNY ') then

Raise_application_error ( -20001, ' don ' t have access to modify this table. ');

End If;

End;

/

Even Sys,system users cannot modify the Foo table

Test

Log the time and character of the modified table.

1, the establishment of the test table

CREATE TABLE employees_copy as select *from hr.employees

2, the establishment of the log table

CREATE TABLE Employees_log (

Who Varchar2 (30),

When date);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.