/*****************************************************************************
*
* Filename         - $Workfile:   uld_weights.sql  $
*
*                     Name              Date      Version     CR Number
* Author           - Gary Roberts
*
* Project Name     - UltraTrak Database
*
* Design Spec
* Section          - UAS/FALCP/SS/3142
*
* Contents         - Live schema uld_weights table
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 2007
*
*****************************************************************************/

PROMPT Creating table ULD_WEIGHTS

create table ULD_WEIGHTS (
   site_id                       number(10) not null,
   carrier                       char(3) not null,
   uld_prefix                    varchar2(3) not null,
   max_weight                    number(10) 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 uld_weights add ( constraint uld_weights_pk primary key (appn_row_id) using index tablespace &1._indexes);

CREATE UNIQUE INDEX uld_weights_uk1 ON uld_weights(site_id, carrier, uld_prefix) tablespace &1._indexes;

alter table uld_weights
  add constraint uld_weights_fk_carrier foreign key (carrier)
  references CARRIER_LOOKUP (ALPHA_CODE);

COMMENT ON TABLE ULD_WEIGHTS IS 'This table contains the maximum load weights of types of ulds';


COMMENT ON COLUMN ULD_WEIGHTS.SITE_ID IS 'The site id for this record';
COMMENT ON COLUMN ULD_WEIGHTS.CARRIER IS 'The carrier to which the row relates';
COMMENT ON COLUMN ULD_WEIGHTS.ULD_PREFIX IS 'The uld prefix for which the max weight is defined';
COMMENT ON COLUMN ULD_WEIGHTS.MAX_WEIGHT IS 'Maximum weight of the ULD';

COMMENT ON COLUMN ULD_WEIGHTS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN ULD_WEIGHTS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN ULD_WEIGHTS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN ULD_WEIGHTS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN ULD_WEIGHTS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN ULD_WEIGHTS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN ULD_WEIGHTS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN ULD_WEIGHTS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN ULD_WEIGHTS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';

/


