BC remote Oracle DBA - Call (800) 766-1884  
Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation








EnterpriseDB: Rules

Oracle Tips by Burleson Consulting

A rule can be thought of as a special type of trigger.  In most instances where it is possible, I would recommend you use a trigger instead of a rule.  The benefit of a rule instead of a trigger is that the rule can be an INSTEAD of rule which triggers do not support.

A rule can be an ALSO rule or an INSTEAD rule.  An ALSO rule will fire a set of commands in addition to the executing command while an INSTEAD rule will fire instead of the executing command.

A restriction on a select rule is that it can only be an INSTEAD rule and must consist of a single select.  It is a better practice to create a view instead of a select rule.

There are six valid commands: NOTHING, NOTIFY, INSERT, UPDATE, DELETE, SELECT.  INSERT, UPDATE, DELETE and SELECT perform as expected.  NOTHING does just that, absolutely nothing.  If you have an INSERT INSTEAD trigger that does NOTHING, you will never be able to add records to the table.  NOTIFY is a database command that pushes a message on a queue. It works a lot like DBMS_ALERT in Oracle.  I will discuss NOTIFY in detail in the next chapter.


            TO <table name>
            [ WHERE <where clause> ]
            DO [ ALSO | INSTEAD ]
            { NOTHING | command(s) }

We can create a rule on the emp table that will also insert data into the emp clone table whenever a record is added to emp.

CREATE OR REPLACE emp_insert_audit_rule
DO ALSO INSERT INTO emp_clone (empno, ename)
  VALUES (:new.empno, :new.ename);


You cannot alter a rule.  You should recreate it.


You cannot grant to a rule.  You would grant to the table that has the rule.


You cannot revoke permissions from a rule.  You would revoke permissions from a table that has the rule.


Drop a rule:

DROP RULE emp_insert_audit_rule;

This is an excerpt from the book "EnterpriseDB: The Definitive Reference" by Rampant TechPress.

Expert Remote DBA

BC is America's oldest and largest Remote DBA Oracle support provider.  Get real Remote DBA experts, call
BC Remote DBA today.



Remote DBA Service

Oracle Tuning Book


Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software







BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.

Hit Counter