/*****************************************************************************
*
* Filename         - $Workfile:   ulds_card_templates.sql  $
*
*                     Name              Date      Version     CR Number
* Author           -  Chris Reason      20/05/03
* Last Update      -  See revision history below.
*
* Project Name     - FALCP.
*
* Source Code
* Identifier       - N/A.
*
* Design Spec
* Section          - FAS/BBTRK/SS/222.
*
* Contents         - Live Schema: Creates the ulds_card_templates table.
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2003
*
*****************************************************************************/


PROMPT Creating table ULD_CARD_TEMPLATES

create table ULD_CARD_TEMPLATES (
   TEMPLATE_NAME                 varchar2(30) NOT NULL,
   AGENT                         varchar2(30) NOT NULL,
   TIMESTAMP                     date NOT NULL,
   FLIGHT_NO                     varchar2(8),
   FLIGHT_DATE                   varchar2(5),
   BAR_CODES                     varchar2(1),
   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 uld_card_templates add ( constraint uld_card_templates_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table uld_card_templates add ( constraint uld_card_templates_uk1 unique (template_name,agent) using index tablespace &1._indexes);

COMMENT ON TABLE ULD_CARD_TEMPLATES IS 'This table contains ULD card template details';

COMMENT ON COLUMN ULD_CARD_TEMPLATES.AGENT IS  'Agent code';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.BAR_CODES IS  'Indicates that bar codes are present';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.FLIGHT_DATE IS  'Flight date';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.FLIGHT_NO IS  'Flight number';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.TEMPLATE_NAME IS  'Name of the template';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.TIMESTAMP IS  'Time the template was created';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.CUSER IS 'The user who created the row';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN ULD_CARD_TEMPLATES.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';

