/*****************************************************************************
*
* Filename         - $Workfile:   stats_access.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - See revision history below.
* Last Update      - See revision history below.
*
* Project Name     - TAGTRAK(Oracle database)
*
* Source Code
* Identifier       - 0/3/300/8010/112
*
* Design Spec
* Section          - 
*
* Contents         - Table definition for stats_access table
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/
/****************************************************************************
* @(#)$Workfile:   stats_access.sql  $  $Revision:   1.2  $
*
* Revision History
*
* Note that user tagtrak is many users. For these users the user
* name is entered as the last line in the change description.
*
* $Log:   /pvcsarch/db_ora/db/source/live/tables/stats_access.svl  $
* 
*    Rev 1.2   21 Jun 2001 14:48:14   tagtrak
* OR:
* CR:
* Re-baseline version 4.0.0 to include patches.
* 
*    Rev 1.1   02 Apr 1998 19:43:44   tagtrak
* OR:
* CR:
* REV:
* Initial Issue
* See label for concession
* 
*    Rev 1.0   26 Feb 1998 11:16:18   tagtrak
* OR:
* CR:
* REV:
* Initial core product version
*
****************************************************************************/


PROMPT Creating table STATS_ACCESS
/*
 * NOTE: There are no referential integrity constraints here
 * as the data in this table is intended to persist for a 
 * certain length of time despite deletions etc in other tables.
 */

create table stats_access (
   contracted_agent              char(5)      not null,
   delegated_agent               char(5),
   flight_no                     char(8)      not null,
   flight_date                   char(5)      not null,
   airport_code                  char(3)      not null,
   timestamp                     date         not null,
   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
);

alter table stats_access add ( constraint stats_access_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table stats_access add ( constraint stats_access_uk1 unique(contracted_agent,delegated_agent,flight_no,flight_date) using index tablespace &1._indexes);

COMMENT ON TABLE STATS_ACCESS IS 'This table contains details about access to flight statistical data';

COMMENT ON COLUMN STATS_ACCESS.AIRPORT_CODE IS  'Airport code';
COMMENT ON COLUMN STATS_ACCESS.CONTRACTED_AGENT IS  'Contracted agent';
COMMENT ON COLUMN STATS_ACCESS.DELEGATED_AGENT IS  'Delegated agent';
COMMENT ON COLUMN STATS_ACCESS.FLIGHT_DATE IS  'Flight date';
COMMENT ON COLUMN STATS_ACCESS.FLIGHT_NO IS  'Flight number';
COMMENT ON COLUMN STATS_ACCESS.TIMESTAMP IS  'Timestamp';
COMMENT ON COLUMN STATS_ACCESS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN STATS_ACCESS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN STATS_ACCESS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN STATS_ACCESS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN STATS_ACCESS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN STATS_ACCESS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN STATS_ACCESS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN STATS_ACCESS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN STATS_ACCESS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
