A system trigger(AFTER CREATE ON DATABASE) . : Database Trigger « Trigger « Oracle PL / SQL






A system trigger(AFTER CREATE ON DATABASE) .

  
SQL>
SQL>
SQL> CREATE TABLE ddl_creations (
  2    user_id       VARCHAR2(30),
  3    object_type   VARCHAR2(20),
  4    object_name   VARCHAR2(30),
  5    object_owner  VARCHAR2(30),
  6    creation_date DATE);

Table created.

SQL>
SQL> CREATE OR REPLACE TRIGGER LogCreations
  2    AFTER CREATE ON DATABASE
  3  BEGIN
  4    INSERT INTO ddl_creations (user_id, object_type, object_name,
  5                               object_owner, creation_date)
  6      VALUES (USER, SYS.DICTIONARY_OBJ_TYPE, SYS.DICTIONARY_OBJ_NAME,
  7              SYS.DICTIONARY_OBJ_OWNER, SYSDATE);
  8  END LogCreations;
  9  /

Trigger created.

SQL>
SQL> DROP TABLE ddl_creations;

Table dropped.

SQL>
SQL> drop trigger LOGCREATIONS;

Trigger dropped.

SQL>

   
  








Related examples in the same category

1.Trigger for database startup event
2.Trigger to log the database shutdown
3.Logon trigger
4.After logon database trigger
5.Log database logon to a table
6.Log a server error to a table
7.Log a server error with information on time, user name, database name
8.creating a logon/logoff auditing system using system-level triggers:
9.Save information about all errors in an after-servererror on database
10.Submit a job for altering user in an after-create-database trigger