/*****************************************************************************
*
* Filename         - misc_bag_exceptions.sql
*
* Project Name     - TAGTRAK(Oracle Database)
*
* Source Code
* Identifier       - 
*
* Design Spec
* Section          -
*
* Contents         - Live Schema: Misc exception codes for bags
*
* Language         - Oracle SQL*Plus script
*
* Classification   - Commercial In Confidence
*
*          (c) Ultra Electronics Limited, 1997
*
*****************************************************************************/

PROMPT Creating table MISC_BAG_EXCEPTIONS

create table misc_bag_exceptions
(
   bag_id                        number(10) not null,
   exception_source              varchar2(10) not null,
   exception_type                varchar2(4) 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 misc_bag_exceptions add ( constraint misc_bag_exceptions_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table misc_bag_exceptions add ( constraint misc_bag_exceptions_fk_bag foreign key (bag_id) references bag (bag_id) on delete cascade);

COMMENT ON TABLE MISC_BAG_EXCEPTIONS IS 'This table contains details of miscellaneous bag exceptions';

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

