-- h:\xconnect\TableGeneration\XCTableGen.tab
--
-- Generated for Oracle 8 on Fri Aug 09  14:39:36 2002 by Server Generator 2.1.24.3.0

-- NOTE:  If you run this from SVRMGR30 you have to coment out the -- PROMPT lines.
--        SVRMGR30 doesn't recognize -- PROMPT as legitimate SQL.

--        EVEN MORE IMPORTANT:  The Design Editor doesn't add the TABLESPACE
--        assingments.  You have to modify table creation lines similar to this:
--        Create table junk(stuff number) TABLESPACE XC_DATA /
--        While you are at it you might as well put them in order - sites, site-sensors
--        etc.  They are originally all over the place.
--	  Done by TNK 8/9/02

SET ECHO ON
SPOOL XCTableGen.tab.OUT

undefine tbl_owner
define tbl_owner = &1

-- PROMPT Creating Table 'XC_SITES'
CREATE TABLE &&tbl_owner..XC_SITES
 (
    STATION_ID VARCHAR2 (30) NOT NULL,
    ENABLED VARCHAR2 (1) NOT NULL,
    UNIT_ID VARCHAR2 (15) NULL,
    SITE_COMMENT VARCHAR2 (32) NULL,
    INSTALLATION_DATE DATE NULL,
    AGENCY VARCHAR2 (32) NULL,
    COUNTRY VARCHAR2 (32) NULL,
    DISTRICT VARCHAR2 (32) NULL,
    CITY VARCHAR2 (32) NULL,
    STATE VARCHAR2 (32) NULL,
    COUNTY VARCHAR2 (32) NULL,
    BASIN VARCHAR2 (32) NULL,
    LATITUDE FLOAT (126) NULL,
    LONGITUDE FLOAT (126) NULL,
    ELEVATION FLOAT (126) NULL,
    COEFFICIENT1 FLOAT (126) NULL,
    COEFFICIENT2 FLOAT (126) NULL,
    COEFFICIENT3 FLOAT (126) NULL,
    WEIGHTING_FACTOR FLOAT (126) NULL,
    SATELLITE_ID VARCHAR2 (8) NULL,
    PRIMARY_CHANNEL NUMBER (6) NULL,
    RANDOM_CHANNEL NUMBER (6) NULL,
    REPORTING_TIME DATE NULL,
    REPORTING_INTERVAL FLOAT (126) NULL,
    LAST_UPDATE DATE NULL,
    TZONE_CODE VARCHAR2 (4) NULL,
    GMT_OFFSET NUMBER (6) NULL,
    SHEF_ID VARCHAR2 (8) NULL,
    ALTERNATE_CHAR_ID_1 VARCHAR2 (10) NULL,
    ALTERNATE_CHAR_ID_2 VARCHAR2 (10) NULL,
    GPSTRING1 VARCHAR2 (20) NULL,
    GPSTRING2 VARCHAR2 (20) NULL,
    GPNUMBER1 FLOAT (126) NULL,
    GPNUMBER2 FLOAT (126) NULL,
    SETUP_FILE_NAME VARCHAR2 (255) NULL,
    LOG_FILE_NAME VARCHAR2 (255) NULL,
    PICTURE_FILE_NAME VARCHAR2 (255) NULL,
    SITE_TYPE NUMBER (6) NULL,
    STATUS NUMBER (6) NULL,
    IPADDRESS VARCHAR2 (20) NULL,
    RADIO_PATH_LIST VARCHAR2 (30) NULL,
    PHONE_NUMBER_LIST VARCHAR2 (40) NULL,
    PHONE_NUMBER2 VARCHAR2 (20) NULL,
    USER_NAME VARCHAR2 (10) NULL,
    PASSWORD VARCHAR2 (10) NULL,
    COMPORT_LIST VARCHAR2 (15) NULL,
    ACKDELAY_LIST VARCHAR2 (10) NULL,
    RESPONSE_TIMEOUT_LIST VARCHAR2 (10) NULL,
    POLL_TYPE NUMBER (6) NULL,
    LOGIN_REQD VARCHAR2 (1) NULL,
    QUICK_PROTOCOL VARCHAR2 (1) NULL,
    AUTO_PROTOCOL VARCHAR2 (1) NULL,
    CONCENTRATOR VARCHAR2 (1) NULL,
    HOURS_AHEAD FLOAT (126) NULL,
    RDI_BASE_TIME DATE NULL,
    RDI_INTERVAL DATE NULL,
    RDI_STAYON DATE NULL,
    TEMPLATE_NAME VARCHAR2 (30) NULL,
    SITE_LONG_NAME VARCHAR2 (50) NULL,
    SITE_CODE NUMBER (6) NULL,
    USGS_ID VARCHAR2 (10) NULL,
    RESERVOIR VARCHAR2 (32) NULL,
    RIVER_MILE FLOAT (126) NULL,
    MODEM_INIT_STRING VARCHAR2 (20) NULL,
    MODEM_HANGUP_STRING VARCHAR2 (20) NULL,
    LAST_POLL DATE NULL,
    TEMPLATE_FLAG        NUMBER (6) DEFAULT 1,
    MBDEVICE_ID          VARCHAR2(4) NULL,
    MBCONSEC_REGISTER    VARCHAR2(1) NULL,
    MBBASE_REGISTER      NUMBER (6) NULL,
    MBREGISTER_TYPE      NUMBER (6) NULL,
    MBREGISTER_COUNT     NUMBER (6) NULL,
    MSGPARITY            NUMBER (6) NULL,
    IMEI_ID VARCHAR2 (15) NULL,
    SMS_ID VARCHAR2 (15) NULL

 );

COMMENT ON COLUMN &&tbl_owner..XC_SITES.STATION_ID IS 'Sites ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.ENABLED IS 'Y or N';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.STATION_ID IS 'Logger name for SSP sites';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SITE_COMMENT IS 'General purpose string for comments on site status';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.INSTALLATION_DATE IS 'Date site was installed';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.AGENCY IS 'Agency/Entity that owns this site';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.COUNTRY IS 'Country where site is located';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.STATE IS 'Political boundary';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.CITY IS 'City Name';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.DISTRICT IS 'District Name';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.COUNTY IS 'Political boundary name';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.BASIN IS 'Name of river basin where site is located';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.LATITUDE IS 'Latitude in degrees, minutes, seconds';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.LONGITUDE IS 'Longitude in degrees, minutes, seconds';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.ELEVATION IS 'Site elevation to 3 decimal precision';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.COEFFICIENT1 IS 'COEFFICIENT1';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.COEFFICIENT2 IS 'COEFFICIENT2';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.COEFFICIENT3 IS 'COEFFICIENT3';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.WEIGHTING_FACTOR IS 'Precip. station weighting for MAP calculation';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SATELLITE_ID IS 'NESDIS Identifier';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.PRIMARY_CHANNEL IS 'Primary satellite channel';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RANDOM_CHANNEL IS 'Secondary satellite channel';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.REPORTING_TIME IS 'Assigned time slot, GMT';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.REPORTING_INTERVAL IS 'Time between reports, hrs';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.LAST_UPDATE IS 'Time of last report from site';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.TZONE_CODE IS 'ASCII zone code, e.g. EST';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.GMT_OFFSET IS 'Time zone offset from GMT';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SHEF_ID IS 'Std. Hydrologic Exchange Fmt. site ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.ALTERNATE_CHAR_ID_1 IS 'Space for alternate character ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.ALTERNATE_CHAR_ID_2 IS 'Space for alternate character ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.GPSTRING1 IS 'General purpose string 1';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.GPSTRING2 IS 'General purpose string 2';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.GPNUMBER1 IS 'General purpose number 1';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.GPNUMBER2 IS 'General purpose number 2';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.LOG_FILE_NAME IS 'Logger file name to poll for data';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SETUP_FILE_NAME IS 'Path to stored RTU setup file';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.PICTURE_FILE_NAME IS 'Path to .jpg or some other site picture';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SITE_TYPE IS 'Logger Type';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.STATUS IS 'Station status';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.IPADDRESS IS 'IP Address';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RADIO_PATH_LIST IS 'Radio path list';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.PHONE_NUMBER_LIST IS 'Phone Number list';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.PHONE_NUMBER2 IS 'Not Used';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.USER_NAME IS 'User Name';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.PASSWORD IS 'Password';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.COMPORT_LIST IS 'Com port list';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.ACKDELAY_LIST IS 'Ack Delay list';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RESPONSE_TIME_LIST IS 'Response Time list';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.POLL_TYPE IS 'Station poll type';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.LOGIN_REQD IS 'Login required';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.QUICK PROTOCOL IS 'Quick protocol used';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.AUTO_PROTOCOL IS 'Auto Protocol';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.CONCENTRATOR IS 'Station is concentrator';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.HOURS_AHEAD IS 'Local station time offset';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RDI_BASE_TIME IS 'EDAS RDI Power On Base Time';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RDI_INTERVAL IS 'EDACS RDI Power On Interval';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RDI_STAYON IS 'EDACS RDI Stay on time';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.TEMPLATE_NAME IS 'Template name';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SITE_LONG_NAME IS 'Station long name';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SITE_CODE IS 'Station site code';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.USGS_ID IS 'USGS ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RESERVOIR IS 'Reservior';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.RIVER_MILE IS 'River Mile';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MODEM_INIT_STRING IS 'Modem initialization string';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MODEM_HANGUP_STRING IS 'Modem hangup string';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.LAST_POLL IS 'Last poll date/time';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.TEMPLATE_FLAG  IS 'Template flag to denote if station is a template station';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MBDEVICE_ID IS 'MODBUS Device ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MBCONSEC_REGISTER IS 'MODBUS Consecutive Registers flag';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MBBASE_REGISTER IS 'MODBUS Base Register number';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MBREGISTER_TYPE IS 'MODBUS Register Type';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MBREGISTER_COUNT IS 'MODBUS Register Count';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.MSGPARITY IS 'MSG SATELLITE Message Parity';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.IMEI_ID IS 'Iridium IMEI ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITES.SMS_ID IS 'GPRS SMS Phone number';

-- PROMPT Creating Table 'XC_SITESENSORS'
CREATE TABLE &&tbl_owner..XC_SITESENSORS
(
    STE_STATION_ID VARCHAR2 (30) NOT NULL,
    SENSORNAME VARCHAR2 (15) NOT NULL,
    ENABLED VARCHAR2 (1) NOT NULL,
    DATA_TABLE VARCHAR2 (12) NOT NULL,
    DESCRIPTION VARCHAR2 (32) NULL,
    MANUFACTURER VARCHAR2 (20) NULL,
    MODEL_NUMBER VARCHAR2 (20) NULL,
    SHEF_PE_CODE VARCHAR2 (7) NULL,
    PARAMETER_CODE VARCHAR2 (12) NULL,
    ALT_PARAMETER_CODE_1 VARCHAR2 (12) NULL,
    ALT_PARAMETER_CODE_2 VARCHAR2 (12) NULL,
    EQUATION VARCHAR2 (128) NULL,
    RATING_TABLE VARCHAR2 (128) NULL,
    OFFSET FLOAT (126) NULL,
    SHIFT FLOAT (126) NULL,
    RIGHT_DIGIT NUMBER (6) NULL,
    HIGH_HIGH_LIMIT FLOAT (126) NULL,
    HIGH_HIGH_ALARM NUMBER (6) NULL,
    HIGH_LIMIT FLOAT (126) NULL,
    HIGH_ALARM NUMBER (6) NULL,
    LOW_LIMIT FLOAT (126) NULL,
    LOW_ALARM NUMBER (6) NULL,
    LOW_LOW_LIMIT FLOAT (126) NULL,
    LOW_LOW_ALARM NUMBER (6) NULL,
    ROC_LIMIT FLOAT (126) NULL,
    ROC_ALARM NUMBER (6) NULL,
    ROC_INTERVAL FLOAT (126) NULL,
    DEADBAND FLOAT (126) NULL,
    NO_CHANGE_INTERVAL FLOAT (126) NULL,
    NO_CHANGE_ALARM NUMBER (6) NULL,
    TEXT_LIMIT VARCHAR2 (32) NULL,
    TEXT_ALARM NUMBER (6) NULL,
    COEFFICIENT1 FLOAT (126) NULL,
    COEFFICIENT2 FLOAT (126) NULL,
    COEFFICIENT3 FLOAT (126) NULL,
    COEFFICIENT4 FLOAT (126) NULL,
    COEFFICIENT5 FLOAT (126) NULL,
    GPNUMBER1 FLOAT (126) NULL,
    GPNUMBER2 FLOAT (126) NULL,
    GPSTRING1 VARCHAR2 (20) NULL,
    GPSTRING2 VARCHAR2 (20) NULL,
    ALERT_ID NUMBER (6) NULL,
    ALERT_TYPE VARCHAR2 (10) NULL,
    TAGNAME VARCHAR2 (15) NULL,
    RAWLIST VARCHAR2 (30) NULL,
    LEFT_DIGIT NUMBER (6) NULL,
    IS_TEXT VARCHAR2 (1) NULL,
    ROUNDOFF_TIME NUMBER (6) NULL,
    DATA_STORE_INTERVAL NUMBER (6) NULL,
    UNITS VARCHAR2 (10) NULL,
    TEMPLATE_NAME VARCHAR2 (15) NULL,
    STATUS NUMBER (6) NULL,
    STD_DEV_LIMIT FLOAT (126) NULL,
    STD_DEV_ALARM NUMBER (6) NULL,
    STD_DEV_INTERVAL FLOAT (126) NULL,
    AVG_LIMIT FLOAT (126) NULL,
    AVG_ALARM NUMBER (6) NULL,
    AVG_INTERVAL FLOAT (126) NULL,
    REFERENCE_1 FLOAT (126) NULL,
    REFERENCE_2 FLOAT (126) NULL,
    DATA_EXCH_NUM VARCHAR2(100) NULL,
    MIKE11_LABEL_1       VARCHAR(50) NULL,
    MIKE11_LABEL_2       VARCHAR(50) NULL,
    NO_ALARM_INTERVAL    FLOAT (126) NULL,
    MBBASE_REGISTER      NUMBER (6) NULL,
    MBREGISTER_TYPE      NUMBER (6) NULL,
    MBTAG_TYPE           NUMBER (6) NULL,
    MBMSW                NUMBER (6) NULL

);

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.STE_STATION_ID IS 'Logger name for SSP sites';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.SENSORNAME IS 'Short name for sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ENABLED IS 'Processing enabled for this sensor Y/N';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.DATA_TABLE IS 'Data table number where data are stored';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.DESCRIPTION IS 'Long descriptive name for sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MANUFACTURER IS 'Manufacturer of sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MODEL_NUMBER IS 'Model Number of sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.SHEF_PE_CODE IS 'Std. Hydrologic Exchange Fmt. physical element code';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.PARAMETER_CODE IS 'Code applied to this type of sensor data';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ALT_PARAMETER_CODE_1 IS 'May be used for an alternate parameter code';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ALT_PARAMETER_CODE_2 IS 'May be used for an alternate parameter code';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.EQUATION IS 'String containing processing equation';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.RATING_TABLE IS 'Path to table file';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.OFFSET IS 'Rating table offset';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.SHIFT IS 'Rating table shift';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.RIGHT_DIGIT IS 'Sensor Right Digit';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.HIGH_HIGH_LIMIT IS 'Highest valid value for this sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.HIGH_HIGH_ALARM IS 'Switch - none, above, below, both';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.HIGH_LIMIT IS 'Highest valid value for this sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.HIGH_ALARM IS 'Switch - none, above, below, both';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.LOW_LIMIT IS 'Lowest valid value for this sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.LOW_ALARM IS 'Switch - none, above, below, both';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.LOW_LOW_LIMIT IS 'Lowest valid value for this sensor';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.LOW_LOW_ALARM IS 'Switch - none, above, below, both';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ROC_LIMIT IS 'Max change rate for data value in units of  per minute';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ROC_ALARM IS 'Switch - none, above, below, both';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ROC_INTERVAL IS 'Interval (secs.) over whch rate is computed';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.DEADBAND IS 'Change in sensor readings of less than this in ROC limit trigger NOC flag';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.NO_CHANGE_INTERVAL IS 'Max time with no change, DAYS AND FRACTION';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.NO_CHANGE_ALARM IS 'Switch - none, on';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.TEXT_LIMIT IS 'Alarm if text matches this string';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.TEXT_ALARM IS 'Switch - none, on';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.COEFFICIENT1 IS 'COEFFICIENT1';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.COEFFICIENT2 IS 'COEFFICIENT2';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.COEFFICIENT3 IS 'COEFFICIENT3';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.COEFFICIENT4 IS 'COEFFICIENT4';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.COEFFICIENT5 IS 'COEFFICIENT5';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.GPNUMBER1 IS 'General purpose number 1';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.GPNUMBER2 IS 'General purpose number 2';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.GPSTRING1 IS 'General purpose string 1';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.GPSTRING2 IS 'General purpose string 2';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ALERT_ID IS 'Alrt sensor ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ALERT_TYPE IS 'Alert sensor types';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.TAGNAME IS 'RTU tagname';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.RAWLIST IS 'Raw List';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.LEFT_DIGIT IS 'Sensor Left Digit';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.IS_TEXT IS 'Text not numerical';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.ROUNDOFF_TIME IS 'Round off Time';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.DATA_STORE_INTERVAL IS 'Sensor store interval';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.UNITS IS 'Units';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.TEMPLATE_NAME IS 'Template Name';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.STATUS IS 'Status';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.STD_DEV_LIMIT IS 'Standard deviation';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.STD_DEV_ALARM IS 'Switch - NONE, ON';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.STD_DEV_INTERVAL IS 'Interval (secs.) over which std. dev. is computed';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.AVG_LIMIT IS 'Average value';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.AVG_ALARM IS 'Switch - NONE, ABOVE, BELOW';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.AVG_INTERVAL IS 'Interval (secs.) over which average is computed';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.REFERENCE_1 IS 'Reference Number 1';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.REFERENCE_2 IS 'Reference Number 2';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.DATA_EXCH_NUM IS 'Data Exchange Number';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MIKE11_LABEL_1 IS 'Mike 11 Label 1';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MIKE11_LABEL_2 IS 'Mike 11 Label 2';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.NO_ALARM_INTERVAL IS 'No Alarm Interval';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MBBASE_REGISTER IS 'MODBUS Base Register';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MBREGISTER_TYPE IS 'MODBUS Reigister Type';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MBTAG_TYPE IS 'MODBUS Tag Type';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORS.MBMSW IS 'MODBUS Most Significant Word';


-- PROMPT Creating Table 'XC_DATA1'
CREATE TABLE &&tbl_owner..XC_DATA1
 (
    STATION_ID VARCHAR2 (30) NOT NULL,
    SENSORNAME VARCHAR2 (15) NOT NULL,
    TIME_TAG DATE NOT NULL,
    SOURCE VARCHAR2 (1) NOT NULL,
    ORIG_VALUE FLOAT (126) NOT NULL,
    ED_VALUE FLOAT (126) NULL,
    FLAG1 VARCHAR2 (1) NULL,
    FLAG2 VARCHAR2 (1) NULL,
    FLAG3 VARCHAR2 (1) NULL,
    FLAG4 VARCHAR2 (1) NULL,
    HIGH_HIGH_FLAG NUMBER (6) NULL,
    HIGH_FLAG NUMBER (6) NULL,
    LOW_FLAG NUMBER (6) NULL,
    LOW_LOW_FLAG NUMBER (6) NULL,
    ROC_FLAG NUMBER (6) NULL,
    NO_CHG_FLAG NUMBER (6) NULL,
    ALARM_FLAG NUMBER (6) NULL,
    STD_DEV_FLAG NUMBER (6) NULL,
    AVG_FLAG NUMBER (6) NULL
 );

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.STATION_ID IS 'STATION ID';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.SENSORNAME IS 'Sensor name';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.TIME_TAG IS 'Data time tag - system format';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.SOURCE IS 'Used to identify message source, e.g. random or self-timed GOES messages';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.ORIG_VALUE IS 'Original data value';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.ED_VALUE IS 'Edited data value';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.FLAG1 IS 'Data quality flag 1';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.FLAG2 IS 'Data quality flag 2';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.FLAG3 IS 'Data quality flag 3';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.FLAG4 IS 'Data quality flag 4';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.HIGH_HIGH_FLAG IS 'High High Alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.HIGH_FLAG IS 'High Alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.LOW_FLAG IS 'Low Alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.LOW_LOW_FLAG IS 'Low Low Alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.ROC_FLAG IS 'Rate of Change Alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.NO_CHG_FLAG IS 'No Change Alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.ALARM_FLAG IS 'Alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.STD_DEV_FLAG IS 'Standard Deviation alarm flag';

COMMENT ON COLUMN &&tbl_owner..XC_DATA1.AVG_FLAG IS 'Average Alarm flag';


-- PROMPT Creating Table 'XC_GOESQC'
CREATE TABLE &&tbl_owner..XC_GOESQC
 (
    NESDIS_ID VARCHAR2 (8) NOT NULL,
    TIME_TAG DATE NOT NULL,
    SOURCE VARCHAR2 (1) NOT NULL,
    STATION_ID VARCHAR2 (30) NULL,
    FAILURE_CODE VARCHAR2 (1) NULL,
    SIG_STRENGTH NUMBER (6) NULL,
    FREQ_OFFSET NUMBER (6) NULL,
    MOD_INDEX VARCHAR2 (1) NULL,
    MOD_QUAL VARCHAR2 (1) NULL,
    CHANNEL NUMBER (6) NULL,
    SAT_LOC VARCHAR2 (1) NULL,
    UC_STATUS VARCHAR2 (2) NULL,
    MESSAGE_LEN NUMBER (6) NULL,
    ACTUAL_LEN NUMBER (6) NULL,
    PARITY NUMBER (6) NULL,
    BUFFER_EMPTY NUMBER (6) NULL,
    BATTERY_VOLTAGE FLOAT (126) NULL,
    SPARE1 FLOAT (126) NULL,
    SPARE2 FLOAT (126) NULL
 );

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.NESDIS_ID IS 'NESDIS satellite station ID';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.TIME_TAG IS 'Time tag of message';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.SOURCE IS 'Data source , R,S,  other';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.STATION_ID IS 'Site ID if we can match it';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.FAILURE_CODE IS 'g,?,W,D,A,B,T,U,M,I,N,Q,C,S';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.SIG_STRENGTH IS 'Number in range 32 - 57 in dB';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.FREQ_OFFSET IS 'Frequency Offset in 50Hz increments -8 to 8 or + or - A - e.g. 0 = 0 to 49Hz, A=500-549 Hz';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.MOD_INDEX IS 'N,H, or L - (Normal, high,low)';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.MOD_QUAL IS 'N,F,P (Normal, fair, poor)';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.CHANNEL IS '0-999 Channel message was on';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.SAT_LOC IS 'E,W,C,A - East,west,central,argos';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.UC_STATUS IS 'Not used always FF';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.MESSAGE_LEN IS 'Message length 0 - 15750';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.PARITY IS 'Parity flag';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.BUFFER_EMPTY IS 'Buffer Empty flag';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.BATTERY_VOLTAGE IS 'Battery Voltage if Sutron message';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.SPARE1 IS 'Spare for later use';

COMMENT ON COLUMN &&tbl_owner..XC_GOESQC.SPARE2 IS 'Spare for later use';


-- PROMPT Creating Table 'XC_RTUQC'
CREATE TABLE &&tbl_owner..XC_RTUQC
(
    STATION_ID VARCHAR2 (30) NOT NULL,
    TIME_TAG DATE NOT NULL,
    RX_TX VARCHAR2 (1) NOT NULL,
    PORT VARCHAR2 (30) NULL,
    SEQUENCENUM NUMBER NULL,
    OPCODE NUMBER NULL,
    STATUS NUMBER (6) NULL,
    RETRIES NUMBER (6) NULL,
    GOOD NUMBER (6) NULL,
    BAD NUMBER (6) NULL,
    CRC NUMBER (6) NULL,
    BATTERY_VOLTAGE FLOAT (126) NULL,
    SPARE1 NUMBER (6) NULL,
    SPARE2 NUMBER (6) NULL
);

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.STATION_ID IS 'Site ID';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.TIME_TAG IS 'Time tag of message';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.RX_TX IS 'RX or TX';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.PORT IS 'COM port name or modem name';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.SEQUENCENUM IS 'SSP sequence number';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.OPCODE IS 'SSP opcode';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.STATUS IS 'SSP status';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.RETRIES IS 'SSP retries';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.GOOD IS 'SSP successfully completes one transmission';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.BAD IS 'SSP fails to complete one transmission';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.CRC IS 'SSP message with CRC error';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.BATTERY_VOLTAGE IS 'Battery Voltage if Sutron message';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.SPARE1 IS 'Spare for later use';

COMMENT ON COLUMN &&tbl_owner..XC_RTUQC.SPARE2 IS 'Spare for later use';

-- PROMPT Creating Table 'XC_TXTDATA1'
CREATE TABLE &&tbl_owner..XC_TXTDATA1
 (STATION_ID VARCHAR2(30) NOT NULL
 ,SENSORNAME VARCHAR2(15) NOT NULL
 ,TIME_TAG DATE NOT NULL
 ,SOURCE VARCHAR2(1) NOT NULL
 ,TEXT_VALUE VARCHAR2(256) NOT NULL
 ,FLAG1 VARCHAR2(1)
 ,FLAG2 VARCHAR2(1)
 ,FLAG3 VARCHAR2(1)
 ,FLAG4 VARCHAR2(1)
 ,MESSAGE_STATUS VARCHAR2(2)
 ,TXT_ALARM_FLAG NUMBER(6)
 );

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.STATION_ID IS 'Site ID where data originates';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.SENSORNAME IS 'Sensor associated with this text';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.TIME_TAG IS 'Time tag associated with text data';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.SOURCE IS 'Used to identify message source, e.g. random or self-timed GOES messages';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.TEXT_VALUE IS 'Text data string';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.FLAG1 IS 'Data quality flag 1';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.FLAG2 IS 'Data quality flag 2';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.FLAG3 IS 'Data quality flag 3';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.FLAG4 IS 'Data quality flag 4';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.MESSAGE_STATUS IS 'Way to track if message read, forwarded, etc., if rqd.';

COMMENT ON COLUMN &&tbl_owner..XC_TXTDATA1.TXT_ALARM_FLAG IS 'Text Alarm flag';

-- PROMPT Creating Table 'XC_PPLIST'
CREATE TABLE &&tbl_owner..XC_PPLIST
 (
    STATION_ID VARCHAR2 (30) 	NOT NULL,
    DATA_LABEL VARCHAR2 (20) 	NOT NULL,
    SENSORNAME VARCHAR2 (15) 	NOT NULL,
    FUNCTION_NAME VARCHAR2(10)	NOT NULL
 );

COMMENT ON COLUMN &&tbl_owner..XC_PPLIST.STATION_ID IS 'Station ID';

COMMENT ON COLUMN &&tbl_owner..XC_PPLIST.SENSORNAME IS 'Short name for sensor';

COMMENT ON COLUMN &&tbl_owner..XC_PPLIST.DATA_LABEL IS 'Data Label for the Post Process';

COMMENT ON COLUMN &&tbl_owner..XC_PPLIST.FUNCTION_NAME IS 'The function name that calculated, such as AVG, SUM, MIN, MAX';


-- PROMPT Creating Table 'XC_PPDATA1'
CREATE TABLE &&tbl_owner..XC_PPDATA1
 (
    STATION_ID VARCHAR2 (30) NOT NULL,
    DATA_LABEL VARCHAR2 (20) NOT NULL,
    SENSORNAME VARCHAR2 (15) NOT NULL,
    FUNCTION_NAME VARCHAR2 (10) NOT NULL,
    TIME_TAG DATE NOT NULL,
    TIME_PERIOD FLOAT (126) NOT NULL,
    PP_VALUE FLOAT (126) NOT NULL,
    FLAG1 VARCHAR2 (1) NULL,
    FLAG2 VARCHAR2 (1) NULL,
    FLAG3 VARCHAR2 (1) NULL,
    VALUE_TIME_TAG DATE NULL,
    PROCESS_TIME_TAG DATE NOT NULL,
    ALTERNATE_LABEL VARCHAR2 (20) NULL
 );

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.STATION_ID IS 'Station ID';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.SENSORNAME IS 'Short name for sensor';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.DATA_LABEL IS 'Data Label for the Post Process';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.FUNCTION_NAME IS 'The function name that calculated, such as AVG, SUM, MIN, MAX';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.TIME_TAG IS 'Starting time tag of the processed period';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.TIME_PERIOD IS 'Number of hours of data used by function.  Note, for monthly data, the hours reflect the actual hours in that month';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.PP_VALUE IS 'Post-processed value';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.FLAG1 IS 'Data quality flag 1';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.FLAG2 IS 'Data quality flag 2';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.FLAG3 IS 'Data quality flag '3;

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.VALUE_TIME_TAG IS 'Exact time value occurred - e.g. time of max';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.PROCESS_TIME_TAG IS 'Exact time the calculation is made';

COMMENT ON COLUMN &&tbl_owner..XC_PPDATA1.ALTERNATE_LABEL IS 'Alternate Label';

-- ROMPT Creating Table 'XC_POLLGROUPS'
CREATE TABLE &&tbl_owner..XC_POLLGROUPS
(
    GROUP_NUM VARCHAR2 (2) NOT NULL,
    ENABLED VARCHAR2 (1) NOT NULL,
    STATION_LIST LONG NULL,
    BASE_TIME NUMBER (6) NULL,
    INTERVAL NUMBER (6) NULL,
    POLL_TYPE NUMBER (6) NULL,
    CONTROL VARCHAR2 (128) NULL,
    CONTROL_ONLY VARCHAR2 (1) NULL,
    TIME_SYNC NUMBER (6) NULL,
    TIME_SYNC_PORT VARCHAR2 (5) NULL,
    TIME_LIMIT DATE NULL,
    OVERRIDE_ORDER VARCHAR2 (1) NULL,
    DESCRIPTION VARCHAR2 (30) NULL,
    CLIENTS VARCHAR2 (255) NULL,
    LOG_FILE VARCHAR2 (20) NULL,
    LOG_FILE_PATH VARCHAR2 (50) NULL,
    OWNER VARCHAR2 (20) NULL,
    RESET_RTABLE VARCHAR(1) NULL
);

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.GROUP_NUM IS 'Pollgroup number';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.ENABLED IS 'Enabled Y or N';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.STATION_LIST IS 'Station List';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.BASE_TIME IS 'Pollgroup basetime';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.INTERVAL IS 'Pollgroup interval';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.POLL_TYPE IS 'Poll Type';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.CONTROL IS 'Control command also';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.CONTROL_ONLY IS 'Conrol command poll group only';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.TIME_SYNC IS 'Time Sync pollgroup';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.TIME_SYNC_PORT IS 'Time sync Port';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.TIME_LIMIT IS 'Time Limit';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.OVERRIDE_ORDER IS 'Override station list order';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.DESCRIPTION IS 'Description';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.CLIENTS IS 'Clients';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.LOG_FILE IS 'Log file';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.LOG_FILE_PATH IS 'Log file Path';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.OWNER IS 'Pollgroup ownner';

COMMENT ON COLUMN &&tbl_owner..XC_POLLGROUPS.RESET_RTABLE IS 'Reset Rating Table flag';


-- ROMPT Creating Table 'XC_LOG'
CREATE TABLE &&tbl_owner..XC_LOG
(
    TIME_TAG DATE NOT NULL,
    SOURCE VARCHAR2 (20) NOT NULL,
    DESCRIPTION VARCHAR2 (128) NULL
);

COMMENT ON COLUMN &&tbl_owner..XC_LOG.TIME_TAG IS 'Time stamp';

COMMENT ON COLUMN &&tbl_owner..XC_LOG.SOURCE IS 'Application source';

COMMENT ON COLUMN &&tbl_owner..XC_LOG.DESCRIPTION IS 'Log message';


-- ROMPT Creating Table 'XC_RECORDIDS'
CREATE TABLE &&tbl_owner..XC_RECORDIDS
(
    STE_STATION_ID VARCHAR2 (30) NOT NULL,
    RECORD_ID VARCHAR2 (10) NOT NULL,
    SENSORS VARCHAR2 (255) NULL
);

COMMENT ON COLUMN &&tbl_owner..XC_RECORDIDS.STE_STATION_ID IS 'Station name';

COMMENT ON COLUMN &&tbl_owner..XC_RECORDIDS.RECORD_ID IS 'Log ID';

COMMENT ON COLUMN &&tbl_owner..XC_RECORDIDS.SENSORS IS 'Sensor list';


-- ROMPT Creating Table 'XC_SITESENSORSDECODE'
CREATE TABLE &&tbl_owner..XC_SITESENSORSDECODE
(
    TOPIC VARCHAR2 (25) NOT NULL,
    STATION VARCHAR2 (30) NOT NULL,
    SENSOR VARCHAR2 (15) NOT NULL,
    SEQNUM NUMBER (6) NOT NULL,
    ENABLED VARCHAR2 (1) NOT NULL,
    FORMAT VARCHAR2 (10) NULL,
    RELATIVE_TIME VARCHAR2 (1) NULL,
    RELATIVE_POS VARCHAR2 (1) NULL,
    ADD_BASE VARCHAR2 (1) NULL,
    BYTE_SIZE NUMBER (6) NULL,
    BIT_SIZE NUMBER (6) NULL,
    BOUND1 NUMBER (6) NULL,
    BOUND2 NUMBER (6) NULL,
    BLOCK_ID VARCHAR2 (50) NULL,
    BYTE_POS NUMBER (6) NULL,
    BIT_POS NUMBER (6) NULL,
    NEXT NUMBER (6) NULL,
    BIT_NEXT NUMBER (6) NULL,
    AMOUNT NUMBER (6) NULL,
    DELTA_TIME NUMBER (6) NULL,
    OFFSET_TIME NUMBER(6) NULL,
    ROUNDOFF_TIME NUMBER(6) NULL,
    SKIP_BLANK NUMBER (6) NULL,
    SKIP_COMMA NUMBER (6) NULL,
    SKIP_LF    NUMBER (6) NULL,
    SKIP_PLUS NUMBER (6) NULL,
    IGNORE_CASE VARCHAR2 (1) NULL,
    TEMPLATE_NAME  VARCHAR(50) NULL
);

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.TOPIC IS 'Decode Topic';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.STATION IS 'Station name';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.SENSOR IS 'Sensor name';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.SEQNUM IS 'Sequence number';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.ENABLED IS 'Enabled Y or N';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.FORMAT IS 'Format';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.RELATIVE_TIME IS 'Relative Time Y or N';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.RELATIVE_POS IS 'Relative Position Y or N';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.ADD_BASE IS 'Add Base Y or N';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BYTE_SIZE IS 'Byte Size';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BIT_SIZE IS 'Bit Size';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BOUND1 IS 'Bound 1';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BOUND2 IS 'Bound 2';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BLOCK_ID IS 'Block ID';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BYTE_POS IS 'Byte Position';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BIT_POS IS 'Bit Position';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.NEXT IS 'Byte Next Position';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.BIT_NEXT IS 'Bit Next Position';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.AMOUNT IS 'Amount';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.DELTA_TIME IS 'Delta Time';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.OFFSET_TIME IS 'Offset Time';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.ROUNDOFF_TIME IS 'Round off Time';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.SKIP_BLANK IS 'Skip Blank';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.SKIP_COMMA IS 'Skip Comman';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.SKIP_PLUS IS 'Skip Line Feed';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.SKIP_PLUS IS 'Skip Plus';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.IGNORE_CASE IS 'Ignore Case';

COMMENT ON COLUMN &&tbl_owner..XC_SITESENSORSDECODE.TEMPLATE_NAME IS 'Template Name';


-- ROMPT Creating Table 'XC_TEMPLATES'
CREATE TABLE &&tbl_owner..XC_TEMPLATES
(
    TEMPLATE_NAME VARCHAR2 (45) NOT NULL,
    TEMPLATE_TYPE NUMBER (6) NULL
);

COMMENT ON COLUMN &&tbl_owner..XC_TEMPLATES.TEMPLATE_NAME IS 'Template Name';

COMMENT ON COLUMN &&tbl_owner..XC_TEMPLATES.TEMPLATE_TYPE  IS 'Template Type';


-- ROMPT Creating Table 'XC_USERS'
CREATE TABLE &&tbl_owner..XC_USERS
(
    USER_NAME VARCHAR2 (15) NOT NULL,
    PASSWORD VARCHAR2 (64) NOT NULL,
    DESCRIPTION VARCHAR2 (64) NULL,
    USER_ACCESS VARCHAR2 (30) NULL
);

COMMENT ON COLUMN &&tbl_owner..XC_USERS.USER_NAME IS 'User name';

COMMENT ON COLUMN &&tbl_owner..XC_USERS.PASSWORD IS 'Password';

COMMENT ON COLUMN &&tbl_owner..XC_USERS.DESCRIPTION IS 'Description';

COMMENT ON COLUMN &&tbl_owner..XC_USERS.USER_ACCESS IS 'User access';


-- PROMPT Creating Table 'XC_LASTVALUES'
CREATE TABLE &&tbl_owner..XC_LASTVALUES
 (
    STATION_ID VARCHAR2(30) NOT NULL,
    SENSORNAME VARCHAR2(15) NOT NULL,
    TIME_TAG DATE NOT NULL,
    IS_TEXT VARCHAR2 (1) NULL,
    NUM_VALUE FLOAT(126),
    TEXT_VALUE VARCHAR2(256) NOT NULL
 )

COMMENT ON COLUMN &&tbl_owner..XC_LASTVALUES.STATION_ID IS 'Station Name';

COMMENT ON COLUMN &&tbl_owner..XC_LASTVALUES.SENSORNAME IS 'Sensor Name';

COMMENT ON COLUMN &&tbl_owner..XC_LASTVALUES.TIME_TAG IS 'Time stamp';

COMMENT ON COLUMN &&tbl_owner..XC_LASTVALUES.IS_TEXT IS 'Is Text Y or N';

COMMENT ON COLUMN &&tbl_owner..XC_LASTVALUES.NUM_VALUE IS 'Sensor numerical value';

COMMENT ON COLUMN &&tbl_owner..XC_LASTVALUES.TEXT_VALUE IS 'Sensor text value';


-- XC_VER
CREATE TABLE &&tbl_owner..XC_VER
( VERSION NUMBER(6) );

COMMENT ON COLUMN &&tbl_owner..XC_VER.VERSION IS 'Version number';

INSERT INTO &&tbl_owner..XC_VER VALUES ( 103 );

COMMIT;

SPOOL OFF
