PROMPT Creating Table GATEWAY_REDO

CREATE TABLE gateway_redo(
   buffer_identifier             VARCHAR2(12) not NULL,
   message_id                    NUMBER(10) not NULL,
   message_part1                 VARCHAR2(4000),
   message_part2                 VARCHAR2(96),
   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 gateway_redo add ( constraint gateway_redo_pk primary key (appn_row_id) using index tablespace &1._indexes);

ALTER TABLE gateway_redo ADD ( CONSTRAINT gateway_redo_uk1 unique (message_id) USING INDEX TABLESPACE &1._indexes);

ALTER TABLE gateway_redo ADD ( CONSTRAINT gateway_redo_uk2 unique (message_id,buffer_identifier) USING INDEX TABLESPACE &1._indexes);

COMMENT ON TABLE GATEWAY_REDO IS 'This table is used to store DCS bag messages until they can be processed';

COMMENT ON COLUMN GATEWAY_REDO.BUFFER_IDENTIFIER IS  'Unique identifier';
COMMENT ON COLUMN GATEWAY_REDO.MESSAGE_ID IS  'Message identifier';
COMMENT ON COLUMN GATEWAY_REDO.MESSAGE_PART1 IS  'First part of the message';
COMMENT ON COLUMN GATEWAY_REDO.MESSAGE_PART2 IS  'Second part of the message';
COMMENT ON COLUMN GATEWAY_REDO.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN GATEWAY_REDO.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN GATEWAY_REDO.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN GATEWAY_REDO.CUSER IS 'The user who created the row';
COMMENT ON COLUMN GATEWAY_REDO.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN GATEWAY_REDO.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN GATEWAY_REDO.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN GATEWAY_REDO.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN GATEWAY_REDO.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
