PROMPT Creating Table flight_loop_data

create table FLIGHT_LOOP_DATA
(
   FLIGHT_ID            NUMBER(10) NOT NULL,
   FLIGHT_NO            CHAR(8) NOT NULL,
   FLIGHT_DATE          CHAR(5) NOT NULL,
   LOGINNAME            CHAR(15) NOT NULL,
   FLIGHT_TYPE          CHAR(1) 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 flight_loop_data add ( constraint flight_loop_data_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table flight_loop_data add ( constraint flight_loop_data_uk1 unique (flight_id, loginname, flight_type) 
using index tablespace &1._indexes);

ALTER TABLE flight_loop_data ADD ( CONSTRAINT flight_loop_fk_tagtrak_users FOREIGN KEY (loginname) REFERENCES tagtrak_users (loginname));

COMMENT ON TABLE FLIGHT_LOOP_DATA IS 'This table contains a list flights selected in the flight loop for a given user and direction';

COMMENT ON COLUMN FLIGHT_LOOP_DATA.FLIGHT_ID IS  'Flight identifier';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.FLIGHT_NO IS  'Flight number';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.FLIGHT_DATE IS  'Flight date';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.LOGINNAME IS  'Login from tagtrak users';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.FLIGHT_TYPE IS  'Type of flight - Inbound (I) or Outbound (O)';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.CUSER IS 'The user who created the row';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN FLIGHT_LOOP_DATA.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
