Oracle数据库自带的几个触发器(最简单触发器格式)
示例如下:
--
create or replace trigger MDSYS.sdo_drop_user
after drop on DATABASE
declare
stmt varchar2(200);
BEGIN
if dictionary_obj_type = 'USER' THEN
stmt := 'DELETE FROM SDO_GEOM_METADATA_TABLE ' ||
' WHERE SDO_OWNER = ''' || dictionary_obj_name || ''' ';
EXECUTE IMMEDIATE stmt;
end if;
end;
---
create or replace trigger SYS.aurora$server$startup after startup on database
call dbms_java.server_startup
--
create or replace trigger SYS.JIS$ROLE_TRIGGER$ after drop on database
when (ora_dict_obj_type='ROLE')
begin
sns_context.role_dropped(ora_dict_obj_name);
http_security_cascade.principal_dropped(ora_dict_obj_name);
end;
--删除前备份数据的器
Create Or Replace Trigger YSPJ.T_Bill_reMain_Del
Before delete On bill_remain
FOR EACH ROW
begin
Insert into BILL_REMAIN_TIGER
Values(:old.BILL_REMAINID,:old.BILL_TYPEID,:old.REMAIN_NUM,:old.ADD_TIME,:old.ORG_ID,
:old.STATE,:old.BILL_ID,'删除记录',Sysdate,user);
End;