PROMPT Creating table CUST_LOYALTY_PROGRAM

CREATE TABLE cust_loyalty_program (
   airline                       VARCHAR2 (3)  NOT NULL,
   tier                          VARCHAR2 (1)  NOT NULL,
   class_from                    VARCHAR2 (1)  NOT NULL,
   class_to                      VARCHAR2 (10) 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 cust_loyalty_program add ( constraint cust_loyalty_program_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table cust_loyalty_program add ( constraint cust_loyalty_program_uk1 unique (airline,tier,class_from) using index tablespace &1._indexes);

COMMENT ON TABLE CUST_LOYALTY_PROGRAM IS 'This table contains the rules for upgrading passengers who are members of a customer loyalty program';

COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.AIRLINE IS  'Airline carrier code';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.CLASS_FROM IS  'The current class of the passenger';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.CLASS_TO IS  'The class they can be upgraded to';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.TIER IS  'Prefix of the frequent flier id sent in a BSM';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.CUSER IS 'The user who created the row';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN CUST_LOYALTY_PROGRAM.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
