text: /* Formatted on 10/6/2014 6:19:43 PM (QP5 v5.126.903.23003) */
  --DROP TABLE ACA.ACA_AUDIT_TRAIL_TBL;
  
  CREATE TABLE ACA.ACA_AUDIT_TRAIL_TBL (USER_ID          NUMBER NOT NULL,
                                        ACTION_TYPE      VARCHAR (30 BYTE),
                                        ACTION_DETAILS   CLOB,
                                        ACTION_TIME      VARCHAR (21 BYTE),
                                        LOGIN_NUMBER     NUMBER,
                                        DFLT_ROW_ID      NUMBER NOT NULL)
  TABLESPACE RHODB
  PCTUSED 0
  PCTFREE 10
  INITRANS 1
  MAXTRANS 255
  STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
  LOGGING
  NOCOMPRESS
  NOCACHE
  NOPARALLEL
  MONITORING;
  
  CREATE UNIQUE INDEX ACA.IDX_DFLT_ROW_ID
     ON ACA.ACA_AUDIT_TRAIL_TBL (DFLT_ROW_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  ALTER TABLE ACA.ACA_AUDIT_TRAIL_TBL ADD (
    CONSTRAINT PK_DFLT_ROW_ID
   PRIMARY KEY
   (DFLT_ROW_ID));
  
  CREATE INDEX ACA.IDX_ACTION_TIME
     ON ACA.ACA_AUDIT_TRAIL_TBL (ACTION_TIME)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  CREATE INDEX ACA.IDX_ACTION_TYPE
     ON ACA.ACA_AUDIT_TRAIL_TBL (ACTION_TYPE)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  CREATE INDEX ACA.IDX_LOGIN_NUMBER
     ON ACA.ACA_AUDIT_TRAIL_TBL (LOGIN_NUMBER)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  
  CREATE INDEX ACA.IDX_USER_ID
     ON ACA.ACA_AUDIT_TRAIL_TBL (USER_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  CREATE SEQUENCE ACA.ACA_AUDIT_TRAIL_TBL_SEQ
     START WITH 1
     MAXVALUE 9223372036854775807
     MINVALUE 1
     NOCYCLE
     CACHE 20
     ORDER;
  
  CREATE OR REPLACE TRIGGER ACA.ACA_AUDIT_TRAIL_TBL_TRG
     BEFORE INSERT
     ON ACA.ACA_AUDIT_TRAIL_TBL
     FOR EACH ROW
     -- OPTIONALLY RESTRICT THIS TRIGGER TO FIRE ONLY WHEN REALLY NEEDED
     WHEN (NEW.DFLT_ROW_ID IS NULL)
  DECLARE
     V_ID   ACA.ACA_AUDIT_TRAIL_TBL.DFLT_ROW_ID%TYPE;
  BEGIN
     SELECT   ACA.ACA_AUDIT_TRAIL_TBL_SEQ.NEXTVAL INTO V_ID FROM DUAL;
  
     :NEW.DFLT_ROW_ID := V_ID;
  END ACA_AUDIT_TRAIL_TBL_TRG;