PROMPT Creating table REFLIGHT_AVOID_DEST

CREATE TABLE REFLIGHT_AVOID_DEST ( 
   SITE_ID                       NUMBER(10)    NOT NULL, 
   CARRIER                       CHAR (3)      NOT NULL,
   AVOID_DEST                    CHAR (3)      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 reflight_avoid_dest add ( constraint reflight_avoid_dest_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table reflight_avoid_dest add ( constraint reflight_avoid_dest_uk1 unique (SITE_ID,CARRIER,AVOID_DEST) using index tablespace &1._indexes);

ALTER TABLE reflight_avoid_dest ADD CONSTRAINT refavd_fk_refset FOREIGN KEY (site_id, carrier) REFERENCES reflight_setup (site_id, carrier) ON DELETE CASCADE;

COMMENT ON TABLE REFLIGHT_AVOID_DEST IS 'This table contains the configured destinations a carrier wishes to avoid when their bags are reflighted';

COMMENT ON COLUMN REFLIGHT_AVOID_DEST.AVOID_DEST IS  'The destination a carriers re-flighted bags may not transfer through.';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.CARRIER IS  'Carrier code';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.CUSER IS 'The user who created the row';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN REFLIGHT_AVOID_DEST.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
