Submit a job for altering user in an after-create-database trigger : Database Trigger « Trigger « Oracle PL / SQL






Submit a job for altering user in an after-create-database trigger

   
SQL>
SQL> create or replace procedure AlterUser (usernameIn in varchar2) is
  2  begin
  3     execute immediate ( 'alter user ' ||usernameIn|| ' default tablespace users');
  4  end;
  5  /

Procedure created.

SQL>
SQL> create or replace trigger SystemAlterUser
  2   after create on database
  3   declare
  4   jobno number;
  5   begin
  6       if ora_dict_obj_type = 'USER' then
  7          dbms_job.submit(job => jobno, what => 'alteruser('''||ora_dict_obj_name||''');');
  8       end if;
  9   end;
 10  /

Trigger created.

SQL>
SQL>
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.A system trigger(AFTER CREATE ON DATABASE) .
9.creating a logon/logoff auditing system using system-level triggers:
10.Save information about all errors in an after-servererror on database