表结构:
create table TZ_GXSX ( ID VARCHAR2(15), PROJECT VARCHAR2(50), TXYX NUMBER(22) default ‘0‘, CDATE DATE, RISK VARCHAR2(10), DEGREE VARCHAR2(10), PROB VARCHAR2(10), PRESSURE_LEVEL VARCHAR2(20), NETWORKDIVISION VARCHAR2(20), AUTHOR VARCHAR2(20), INP_DATE DATE )
直接更新:
create or replace trigger GXSX_trg before update ON TZ_GXSX FOR EACH ROW BEGIN :new.INP_DATE:=sysdate; EXCEPTION WHEN OTHERS THEN RAISE; END GXSX_trg;
排除指定列名"CDATE" 来执行更新:
create or replace trigger GXSX_trg before update ON TZ_GXSX FOR EACH ROW BEGIN if updating(‘CDATE‘)=false then :new.INP_DATE:=sysdate; end if; EXCEPTION WHEN OTHERS THEN RAISE; END GXSX_trg;
时间: 2024-10-14 16:38:55