12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Designing TriggersNote: A procedure called by a trigger cannot run the previoustransaction control statements, because the procedure runs within thecontext of the trigger body.Statements inside a trigger can reference remote schema objects. However, pay specialattention when calling remote procedures from within a local trigger. If a timestamp orsignature mismatch is found during execution of the trigger, then the remoteprocedure is not run, and the trigger is invalidated.System Trigger RestrictionsOnly committed triggers are fired. For example, if you create a trigger that should befired after all CREATE events, then the trigger itself does not fire after the creation,because the correct information about this trigger was not committed at the time whenthe trigger on CREATE events was fired.For example, if you execute the following <strong>SQL</strong> statement:CREATE OR REPLACE TRIGGER my_triggerAFTER CREATE ON DATABASEBEGINNULL;END;Then, trigger my_trigger is not fired after the creation of my_trigger. <strong>Oracle</strong>Database does not fire a trigger that is not committed.9.2.3 Privileges Needed to Work with TriggersTo create a trigger in your schema, you must have the CREATE TRIGGER systemprivilege, and either:■■Own the table specified in the triggering statement, orHave the ALTER privilege for the table in the triggering statement, or■ Have the ALTER ANY TABLE system privilegeTo create a trigger in another user's schema, or to reference a table in another schemafrom a trigger in your schema, you must have the CREATE ANY TRIGGER systemprivilege. With this privilege, the trigger can be created in any schema and can beassociated with any user's table. In addition, the user creating the trigger must alsohave EXECUTE privilege on the referenced procedures, functions, or packages.To create a trigger on DATABASE, you must have the ADMINISTER DATABASETRIGGER privilege. If this privilege is later revoked, then you can drop the trigger, butnot alter it.The object privileges to the schema objects referenced in the trigger body must begranted to the trigger owner explicitly (not through a role). The statements in thetrigger body operate under the privilege domain of the trigger owner, not the privilegedomain of the user issuing the triggering statement. This is similar to the privilegemodel for stored procedures.9-6 <strong>SQL</strong> <strong>Developer</strong> Online Help

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!