Trigger Learning (DDL triggers)

Source: Internet
Author: User

/* Create a trigger to disallow new objects */

sql> Create TRIGGER no_create 2 after CREATE on SCHEMA 3 BEGIN 4 raise_application_error (5-2000, 6 ' E  Rror:objects cannot is created in the production database. '  7);  8 END; 9/

Trigger created

Sql> CREATE TABLE Demo (col1 number);  CREATE TABLE Demo (col1 number) ORA-00604: recursive SQL Level 1 Error ORA-21000:-2000 raise_application_error Error number parameter out of range ORA-06512: Line 2

/* Create a trigger that suppresses the deletion of objects */

CREATE OR REPLACE TRIGGER undroppablebefore drop on Schemabegin raise_application_error ( -20000, ' You cannot drop me! I am invincible! '); END;

Trigger Learning (DDL triggers)

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.