PROMPT Creating table CARRIER_SITE_CONFIG

CREATE TABLE CARRIER_SITE_CONFIG ( 
   SITE_ID                       NUMBER(10)    NOT NULL,
   ALPHA_CODE                    CHAR (3)      NOT NULL, 
   CONFIG_ITEM                   VARCHAR2(20)  NOT NULL,
   CONFIG_VALUE                  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 carrier_site_config add ( constraint carrier_site_config_pk primary key (appn_row_id) using index tablespace &1._indexes);

alter table carrier_site_config add ( constraint carrier_site_config_uk1 unique (site_id,alpha_code,config_item) using index tablespace &1._indexes);

ALTER TABLE CARRIER_SITE_CONFIG ADD  CONSTRAINT FK_CSC_CL FOREIGN KEY (ALPHA_CODE) REFERENCES CARRIER_LOOKUP (ALPHA_CODE) ;

ALTER TABLE CARRIER_SITE_CONFIG ADD  CONSTRAINT FK_CSC_SI FOREIGN KEY (SITE_ID) REFERENCES SITE_INFO (SITE_ID) ;

COMMENT ON TABLE CARRIER_SITE_CONFIG IS 'This table contains details of which configuration items per site are available for each carrier';

COMMENT ON COLUMN CARRIER_SITE_CONFIG.ALPHA_CODE IS  'Carrier code';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.CONFIG_ITEM IS  'Configuration item';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.CONFIG_VALUE IS  'Value of the configuration item';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.SITE_ID IS  'Site identifier';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.CUSER IS 'The user who created the row';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN CARRIER_SITE_CONFIG.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
