WEB开发网
开发学院数据库Oracle 实例讲解Oracle数据库自带的几个触发器 阅读

实例讲解Oracle数据库自带的几个触发器

 2009-04-13 13:13:18 来源:WEB开发网   
核心提示:Oracle数据库自带的几个触发器(最简单触发器格式)示例如下:--createorreplacetriggerMDSYS.sdo_drop_userafterdroponDATABASEdeclarestmtvarchar2(200);BEGINifdictionary_obj_type='USER'

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;

Tags:实例 讲解 Oracle

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接