/*****************************************************************************
*
* Filename         - $Workfile:   SYSTEM_LOGS.sql  $
*
* Author           - Dave Banks
*
* Project Name     - UltraTrak Core 
*
* Source Code
* Identifier       - Database (Master Standby) 
*
* Design Spec
* Section          - 
*
* Contents         - Database script to create table SYSTEM_LOGS
*
* Language         - Oracle SQL script      
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2006
*
*****************************************************************************/

PROMPT Creating Table 'SYSTEM_LOGS'
CREATE TABLE SYSTEM_LOGS
 (ROW_CREATE_TIME DATE
 ,ROW_DATE_TIME DATE
 ,CUSER VARCHAR2(30)
 ,MUSER VARCHAR2(30)
 ,MTERM VARCHAR2(64)
 ,SOURCE VARCHAR2(8)
 ,TO_BE_ARCHIVED VARCHAR2(1)
 ,APPN_ROW_ID NUMBER(18) NOT NULL
 ,SYSTEM_ID NUMBER(4) DEFAULT 0 NOT NULL
 ,LOG_NUMBER NUMBER(6) NOT NULL
 ,TEXT VARCHAR2(1024)
 ,PARAMETERS VARCHAR2(1024)
 ,LOCAL_CREATE_TIME DATE
 ,TABLE_NAME VARCHAR2(30)
 ,TABLE_APPN_ROW_ID NUMBER(18)
 )
 PCTUSED 90
 PCTFREE 5
 STORAGE
 (
   INITIAL 96M
   NEXT 96M
   PCTINCREASE 0
 ) TABLESPACE APPN_LOGS_TABLES
/

PROMPT Creating Primary Key on 'SYSTEM_LOGS'
ALTER TABLE SYSTEM_LOGS
 ADD (CONSTRAINT SYSTEM_LOGS_PK PRIMARY KEY
  (APPN_ROW_ID)
 USING INDEX
 PCTFREE 5
 STORAGE
 (
   INITIAL 4M
   NEXT 4M
   PCTINCREASE 0
 ) TABLESPACE APPN_LOGS_IDXS)
/

PROMPT Creating Check Constraint on 'SYSTEM_LOGS'
ALTER TABLE SYSTEM_LOGS
 ADD (CONSTRAINT SYSTEM_LOGS_LOG_NO CHECK (LOG_NUMBER >= 0))
/

