oracle生成多表触发器sql
时间:2021-07-01 10:21:17
帮助过:12人阅读
select
‘CREATE OR REPLACE
TRIGGER ‘||table_name
||‘
BEFORE UPDATE on ‘||table_name
||‘
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
BEGIN
IF updating THEN
:NEW.C_UPDATE_TIME:= SYSDATE;
IF :NEW.C_DATA_STATUS=‘‘4‘‘ THEN
:NEW.C_DATA_STATUS:=‘‘4‘‘;
ELSE
:NEW.C_DATA_STATUS:=‘‘2‘‘;
END IF;
END IF;
END;
/
alter trigger ‘||table_name
||‘ enable;‘ as triggerSql
from tabs
where table_name
like ‘HY%‘ order by table_name;
--:NEW.C_DATA_STATUS:=‘‘4‘‘中的:=是赋值,‘‘是转义单引号
--查询触发器
select trigger_name
from all_triggers
where trigger_name
like ‘HY%‘;
oracle生成多表触发器sql
标签:生成 ble triggers date 更新 create 单引号 sql 触发器