Trigger Application Trigger

Source: Internet
Author: User

First, there is a table:

CREATE TABLE T_salary (  name   VARCHAR2, age number    (2),  SALARY number (5)), insert into t_salary (name, age, SALARY) VALUES (' Wyl ', Th, 63000), insert into t_salary (name, age, SALARY) VALUES (' Werxiao ', +, 6012); Insert I Nto t_salary (name, age, salary) VALUES (' Lisi ', si, 7000), insert into t_salary (name, age, salary) VALUES (' Zhangsan ', 42, 4521);

Trigger Scenario 1: Complex security checks, as follows

  

CREATE OR REPLACE TRIGGER t_security_t_salarybefore updateon t_salary/*   trigger Scenario 1: Complex security checks   prohibit operating tables   during non-working hours Weekends or not between 9 and 18 points, for non-working time */begin  IF (To_char (sysdate, ' Day ') in (' Saturday ', ' Sunday ')) or  To_number (To_char (Sysdate, ' Hh24 ')) not between 9  and then--to_number (To_char (sysdate, ' hh24 ')) between 9 and then  --Prohibit insert new employee 
  
   raise_application_error ('-20002 ', ' non-working hours not allowed to operate this table ');  END IF; END;
  

Where the first parameter of Raise_application_error () is between 20999 and-20000. As follows:

Trigger Application Trigger

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.