Oracle inserts or updates a specified column to execute a trigger

Source: Internet
Author: User

Table structure:

CREATE TABLE Tz_gxsx (  ID              VARCHAR2 (),  PROJECT         VARCHAR2 (0),  txyx number            (  CDATE           DATE,  RISK            VARCHAR2 (Ten),  degree          VARCHAR2 (Ten),  PROB            VARCHAR2 (+),  pressure_ Level  VARCHAR2,  networkdivision VARCHAR2 (),  AUTHOR          VARCHAR2,  inp_date        DATE)

Direct update:

Create or replace trigger GXSX_TRG  before update on TZ_GXSX for each  rowbegin:new. Inp_date:=sysdate; EXCEPTION when OTHERS and then    RAISE; END GXSX_TRG;

Exclude the specified column name "CDATE" to perform the update:

Create or replace trigger GXSX_TRG  before update on TZ_GXSX for each  rowbegin if updating (' CDATE ') =false   Then : New. Inp_date:=sysdate; End If; EXCEPTION when OTHERS and then    RAISE; END GXSX_TRG;

Oracle inserts or updates a specified column to execute a 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.