rem *********************************************************************
rem *                                                                   *
rem *             Copyright (c) Ultra Electronics Airport Systems       *
rem *                           All rights reserved.                    *
rem *                                                                   *
rem *********************************************************************
rem *                                                                   *
rem * Filename:             mct.sql                                     *
rem * Module Name:          mct                                         *
rem * Subsystem Name:       tables                                      *
rem * Originating Author:   James Creegan                               *
rem * Design Reference:     FAS/BBTRK/SD/225                            *
rem *                                                                   *
rem *********************************************************************
rem *                                                                   *
rem * Description:                                                      *
rem *  Script to create the MCT table and it's constraints              *
rem *********************************************************************
rem *                                                                   *
rem * Program Identification Array:                                     *
rem *                                                                   *
rem * "%Z%%M% VERSION %I% %E% %U%"
rem *                                                                   *
rem *********************************************************************
rem *                                                                   *
rem * Modification History:                                             *
rem *                                                                   *
rem * Rel Date/Time      Proj/Id   CA Ref/Details Of Change             *
rem * --- -------------- --------  ------------------------------------ *
rem * 1.0 28 May 03                File initially checked in            *
rem *********************************************************************/

PROMPT Creating table MCT

CREATE TABLE mct (
   agent                         VARCHAR2(5) NOT NULL ,
   terminal1                     VARCHAR2(10) NOT NULL ,
   terminal2                     VARCHAR2(10) NOT NULL ,
   min_connection_time           NUMBER NOT NULL ,
   max_connection_time           NUMBER NOT NULL ,
   site_id                       NUMBER 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 mct add ( constraint mct_pk primary key (appn_row_id) using index tablespace &1._indexes);

ALTER TABLE mct ADD ( CONSTRAINT mct_uk1 unique (agent,terminal1,terminal2,site_id) USING INDEX TABLESPACE &1._indexes);

COMMENT ON TABLE MCT IS 'This table contains the minimum and maximum connection time thresholds for baggage between two terminals';

COMMENT ON COLUMN MCT.AGENT IS  'Agent code';
COMMENT ON COLUMN MCT.MAX_CONNECTION_TIME IS  'Maximum connection time';
COMMENT ON COLUMN MCT.MIN_CONNECTION_TIME IS  'Mininum connection time';
COMMENT ON COLUMN MCT.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN MCT.TERMINAL1 IS  'First terminal';
COMMENT ON COLUMN MCT.TERMINAL2 IS  'Second terminal';
COMMENT ON COLUMN MCT.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN MCT.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN MCT.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN MCT.CUSER IS 'The user who created the row';
COMMENT ON COLUMN MCT.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN MCT.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN MCT.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN MCT.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN MCT.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
