text: CREATE TABLE ALARM_CURRENT
  (
      TS_ID int NOT NULL UNIQUE,
      LIMIT_SET_ID int NOT NULL,
      ASSERT_TIME NUMBER(19) NOT NULL,
      DATA_VALUE double precision,
      DATA_TIME NUMBER(19),
      ALARM_FLAGS int NOT NULL,
      MESSAGE varchar2(256),
      LAST_NOTIFICATION_SENT NUMBER(19),
  	db_office_code integer default &dflt_office_code
  ) &TBL_SPACE_SPEC;
  
  CREATE TABLE ALARM_EVENT
  (
  	ALARM_EVENT_ID INT NOT NULL UNIQUE,
  	ALARM_GROUP_ID INT NOT NULL,
  	LOADING_APPLICATION_ID INT NOT NULL,
  	PRIORITY INT NOT NULL,
  	PATTERN varchar2(256),
  	db_office_code integer default &dflt_office_code
  ) &TBL_SPACE_SPEC;
  
  
  CREATE TABLE ALARM_GROUP
  (
  	ALARM_GROUP_ID INT NOT NULL UNIQUE,
  	ALARM_GROUP_NAME VARCHAR2(32) NOT NULL UNIQUE,
  	LAST_MODIFIED NUMBER(19) NOT NULL,
  	db_office_code integer default &dflt_office_code
  ) &TBL_SPACE_SPEC;
  
  CREATE TABLE ALARM_HISTORY
  (
      TS_ID int NOT NULL,
      LIMIT_SET_ID int NOT NULL,
      ASSERT_TIME NUMBER(19) NOT NULL,
      DATA_VALUE double precision,
      DATA_TIME NUMBER(19),
      ALARM_FLAGS int NOT NULL,
      MESSAGE varchar2(256),
      END_TIME NUMBER(19) NOT NULL,
      CANCELLED_BY varchar2(32),
  	db_office_code integer default &dflt_office_code,
      PRIMARY KEY (TS_ID, LIMIT_SET_ID, ASSERT_TIME)
  ) &TBL_SPACE_SPEC;
  
  CREATE TABLE ALARM_LIMIT_SET
  (
      LIMIT_SET_ID int NOT NULL UNIQUE,
      SCREENING_ID int NOT NULL,
      season_name varchar2(24),
      reject_high double precision,
      critical_high double precision,
      warning_high double precision,
      warning_low double precision,
      critical_low double precision,
      reject_low double precision,
      stuck_duration varchar2(32),
      stuck_tolerance double precision,
      stuck_min_to_check double precision,
      stuck_max_gap varchar2(32),
      roc_interval varchar2(32),
      reject_roc_high double precision,
      critical_roc_high double precision,
      warning_roc_high double precision,
      warning_roc_low double precision,
      critical_roc_low double precision,
      reject_roc_low double precision,
      missing_period varchar2(32),
      missing_interval varchar2(32),
      missing_max_values int,
      hint_text varchar2(256),
  	db_office_code integer default &dflt_office_code,
  	CONSTRAINT LIMIT_SET_SCRSEA_UNIQUE UNIQUE(SCREENING_ID, season_name)
  ) &TBL_SPACE_SPEC;
  
  CREATE TABLE ALARM_SCREENING
  (
      SCREENING_ID int NOT NULL UNIQUE,
      SCREENING_NAME varchar2(32) NOT NULL UNIQUE,
      SITE_ID int,
      DATATYPE_ID int NOT NULL,
      START_DATE_TIME NUMBER(19),
      LAST_MODIFIED NUMBER(19) NOT NULL,
      ENABLED VARCHAR2(5) DEFAULT 'true' NOT NULL,
      ALARM_GROUP_ID int,
      SCREENING_DESC varchar2(1024),
  	db_office_code integer default &dflt_office_code,
  	CONSTRAINT AS_SDI_START_UNIQUE UNIQUE(SITE_ID, DATATYPE_ID, START_DATE_TIME)
  ) &TBL_SPACE_SPEC;
  
  CREATE TABLE EMAIL_ADDR
  (
  	ALARM_GROUP_ID INT NOT NULL,
  	ADDR VARCHAR2(256) NOT NULL,
  	db_office_code integer default &dflt_office_code,
  	PRIMARY KEY (ALARM_GROUP_ID, ADDR)
  ) &TBL_SPACE_SPEC;
  
  CREATE TABLE FILE_MONITOR
  (
  	ALARM_GROUP_ID INT NOT NULL,
  	PATH VARCHAR2(256) NOT NULL,
  	PRIORITY INT NOT NULL,
  	MAX_FILES int,
  	MAX_FILES_HINT VARCHAR2(128),
  	-- Maximum Last Modify Time
  	MAX_LMT VARCHAR2(32),
  	MAX_LMT_HINT VARCHAR2(128),
  	ALARM_ON_DELETE VARCHAR2(5),
  	ON_DELETE_HINT VARCHAR2(128),
  	MAX_SIZE NUMBER(19),
  	MAX_SIZE_HINT VARCHAR2(128),
  	ALARM_ON_EXISTS VARCHAR2(5),
  	ON_EXISTS_HINT VARCHAR2(128),
  	ENABLED VARCHAR2(5),
  	db_office_code integer default &dflt_office_code,
  	PRIMARY KEY (ALARM_GROUP_ID, PATH)
  ) &TBL_SPACE_SPEC;
  
  CREATE TABLE PROCESS_MONITOR
  (
  	ALARM_GROUP_ID INT NOT NULL,
  	LOADING_APPLICATION_ID INT NOT NULL,
  	ENABLED VARCHAR2(5),
  	db_office_code integer default &dflt_office_code,
  	PRIMARY KEY (ALARM_GROUP_ID, LOADING_APPLICATION_ID)
  ) &TBL_SPACE_SPEC;
  
  ALTER TABLE PROCESS_MONITOR
  	ADD CONSTRAINT PROCESS_MONITOR_FK1
  	FOREIGN KEY (ALARM_GROUP_ID)
  	REFERENCES ALARM_GROUP (ALARM_GROUP_ID);
  
  ALTER TABLE FILE_MONITOR
  	ADD CONSTRAINT FILE_MONITOR_FK1
  	FOREIGN KEY (ALARM_GROUP_ID)
  	REFERENCES ALARM_GROUP (ALARM_GROUP_ID);
  
  ALTER TABLE EMAIL_ADDR
  	ADD CONSTRAINT EMAIL_ADDR_FK1
  	FOREIGN KEY (ALARM_GROUP_ID)
  	REFERENCES ALARM_GROUP (ALARM_GROUP_ID);
  
  ALTER TABLE PROCESS_MONITOR
  	ADD CONSTRAINT PROCESS_MONITOR_FKLA
  	FOREIGN KEY (LOADING_APPLICATION_ID)
  	REFERENCES HDB_LOADING_APPLICATION(LOADING_APPLICATION_ID);
  
  ALTER TABLE ALARM_SCREENING
      ADD CONSTRAINT ALARM_SCREENING_FKAGI
  	FOREIGN KEY (ALARM_GROUP_ID)
      REFERENCES ALARM_GROUP (ALARM_GROUP_ID);
  
  ALTER TABLE ALARM_HISTORY
      ADD CONSTRAINT ALARM_HISTORY_FKLSI
  	FOREIGN KEY (LIMIT_SET_ID)
      REFERENCES ALARM_LIMIT_SET (LIMIT_SET_ID);
  
  ALTER TABLE ALARM_CURRENT
      ADD CONSTRAINT ALARM_CURRENT_FKLSI
  	FOREIGN KEY (LIMIT_SET_ID)
      REFERENCES ALARM_LIMIT_SET (LIMIT_SET_ID);
  
  ALTER TABLE ALARM_LIMIT_SET
      ADD CONSTRAINT LIMIT_SET_FKSI
  	FOREIGN KEY (SCREENING_ID)
      REFERENCES ALARM_SCREENING (SCREENING_ID);
  
  CREATE INDEX AS_LAST_MODIFIED ON ALARM_SCREENING (LAST_MODIFIED);
  