PROMPT Creating table REFLIGHT_DEST_TX

CREATE TABLE REFLIGHT_DEST_TX ( 
   SITE_ID                       NUMBER(10)    NOT NULL, 
   CARRIER                       CHAR (3)	 NOT NULL,
   DEST                          CHAR (3)      NOT NULL,
   TELETYPE_ADDRESS              VARCHAR2 (15) 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_dest_tx add ( constraint reflight_dest_tx_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table reflight_dest_tx add ( constraint reflight_dest_tx_uk1 unique (SITE_ID,CARRIER,DEST,TELETYPE_ADDRESS) using index tablespace &1._indexes);

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

COMMENT ON TABLE REFLIGHT_DEST_TX IS 'This table contains a list of Teletype addresses per location/destination for a carrier that will be used when sending a WorldTracer FWD message';

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