PROMPT Creating table REFLIGHT_ULDS

CREATE TABLE REFLIGHT_ULDS ( 
   ULD_NO                        CHAR (10)     NOT NULL, 
   FLIGHT_ID                     NUMBER (10)	 NOT NULL,
   SITE_ID                       NUMBER (10)   NOT NULL,
   ULD_NO_OF_BAGS                NUMBER (6),
   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_ulds add ( constraint reflight_ulds_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table reflight_ulds add ( constraint reflight_ulds_uk1 unique (ULD_NO,FLIGHT_ID) using index tablespace &1._indexes);

ALTER TABLE reflight_ulds ADD CONSTRAINT refuld_fk_refflt FOREIGN KEY (flight_id) REFERENCES reflight_flight (flight_id) ;

COMMENT ON TABLE REFLIGHT_ULDS IS 'This table contains reflight ULD information';

COMMENT ON COLUMN REFLIGHT_ULDS.FLIGHT_ID IS  'Flight identifier';
COMMENT ON COLUMN REFLIGHT_ULDS.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN REFLIGHT_ULDS.ULD_NO IS  'ULD number';
COMMENT ON COLUMN REFLIGHT_ULDS.ULD_NO_OF_BAGS IS  'Number of bags in the ULD';
COMMENT ON COLUMN REFLIGHT_ULDS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN REFLIGHT_ULDS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN REFLIGHT_ULDS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN REFLIGHT_ULDS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN REFLIGHT_ULDS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN REFLIGHT_ULDS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN REFLIGHT_ULDS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN REFLIGHT_ULDS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN REFLIGHT_ULDS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
