Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> DB Trigger to keep record of DDL

DB Trigger to keep record of DDL

From: <com.banilejas_at_codetel.net.do>
Date: Thu, 04 Apr 2002 12:58:25 -0800
Message-ID: <F001.0043BF0A.20020404125825@fatcity.com>


I did that trigger, it works if the only is logged in just once. It gives me the errors of more rows returned 1422.

How can I know in what session he is.

CREATE OR REPLACE TRIGGER CONTROL_DDL
   BEFORE DDL ON DATABASE
DECLARE

   NOMBRE_MAQUINA         VARCHAR2(20);
   USUARIO_MAQUINA        VARCHAR2(20);

BEGIN
   SELECT MACHINE, OSUSER INTO NOMBRE_MAQUINA, USUARIO_MAQUINA       FROM V$SESSION
   WHERE
      USERNAME = ORA_LOGIN_USER;
   INSERT INTO CONTROL_OBJETOS (USUARIO,      BASE_DATOS,
                                HORA,         OPERACION, 
                                ESQUEMA,      TIPO_OBJETO,
                                OBJETO,       MAQUINA,
                                USUARIO_OS)
   VALUES
                               (ORA_LOGIN_USER,     ORA_DATABASE_NAME,
                                SYSDATE,            ORA_SYSEVENT,
                                ORA_DICT_OBJ_OWNER, ORA_DICT_OBJ_TYPE,
                                ORA_DICT_OBJ_NAME,  NOMBRE_MAQUINA,
                                USUARIO_MAQUINA);
END;
                                 
                                 

    TIA Ramon E. Estevez

/
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: com.banilejas_at_codetel.net.do

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Apr 04 2002 - 14:58:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US