Thursday, February 8, 2018
PLSQL DDL Triggers with examples
/*****************************************************************************
DDL Triggers Examples..
CREATE OR REPLACE TRIGGER DDLTrigger_name
AFTER DDL/LOGON/LOGOFF ON DATABASE/SCHEMA
BEGIN
-----
END;
******************************************************************************/
CREATE TABLE DDL_TABLE_LOG
(
ora_dict_obj_name VARCHAR2(100),
ora_login_user VARCHAR2(100),
creation_date DATE,
ora_sysevent VARCHAR2(100),
ora_dict_obj_type VARCHAR2(100),
ora_dict_obj_owner VARCHAR2(100)
);
/
CREATE OR REPLACE TRIGGER MY_DDL_TRIGGER AFTER DDL ON DATABASE
BEGIN
INSERT
INTO DDL_TABLE_LOG VALUES
(
ora_dict_obj_name ,
ora_login_user ,
sysdate ,
ora_sysevent ,
ora_dict_obj_type ,
ora_dict_obj_owner
);
END;
/
select * from DDL_TABLE_LOG;
truncate table DDL_TABLE_LOG;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment