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

PROMPT Creating Table 'DB_NODE_STATE'
CREATE TABLE DB_NODE_STATE
 (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
 ,M_OR_S VARCHAR2(1) NOT NULL
 )
 PCTUSED 90
 PCTFREE 5
 STORAGE
 (
   INITIAL 20K
   NEXT 20K
   PCTINCREASE 0
 ) TABLESPACE APPN_GENERAL_TABLES
/


PROMPT Creating Primary Key on 'DB_NODE_STATE'
ALTER TABLE DB_NODE_STATE
 ADD (CONSTRAINT DB_NODE_STATE_PK PRIMARY KEY
  (APPN_ROW_ID)
 USING INDEX
 PCTFREE 5
 STORAGE
 (
   INITIAL 20K
   NEXT 20K
   PCTINCREASE 0
 ) TABLESPACE APPN_GENERAL_IDXS)
/

PROMPT Creating Check Constraint on 'DB_NODE_STATE'
ALTER TABLE DB_NODE_STATE
 ADD (CONSTRAINT DB_NODE_STATE_M_OR_S CHECK (M_OR_S IN ('M','S','N',' ')))
/




