-- C:\Andy\svn\WEBMIP\Schema\mip.tab
--
-- Generated for Oracle 10g on Fri Dec 21  17:23:19 2007 by Server Generator 10.1.2.6.18
 


PROMPT Creating Table 'SYSTEM_CONFIGURATION'
CREATE TABLE SYSTEM_CONFIGURATION
 (PARAMETER VARCHAR2(240) NOT NULL
 ,VALUE VARCHAR2(240)
 ,DESCRIPTION VARCHAR2(240)
 )
 NOCACHE
/

PROMPT Creating Table 'REGULATORS'
CREATE TABLE REGULATORS
 (CODE VARCHAR2(80) NOT NULL
 ,RETY_CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 ,REGULATOR_SIZE NUMBER NOT NULL
 ,LOCK_UP NUMBER NOT NULL
 )
/

PROMPT Creating Table 'SERVICE_PRESSURE_TYPES'
CREATE TABLE SERVICE_PRESSURE_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'QUOTE_STATUSES'
CREATE TABLE QUOTE_STATUSES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'PARTY_CONTACT_MECHANISMS'
CREATE TABLE PARTY_CONTACT_MECHANISMS
 (COME_ID NUMBER NOT NULL
 ,PRTY_ID NUMBER NOT NULL
 ,START_DATE DATE NOT NULL
 ,PADDR_ADDR_CODE VARCHAR2(80)
 ,PADDR_PRTY_ID NUMBER
 ,PADDR_START_DATE DATE
 ,END_DATE DATE
 ,COMMENTS VARCHAR2(255)
 )
/

PROMPT Creating Table 'CARE_CATEGORIES'
CREATE TABLE CARE_CATEGORIES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'RELIEF_VALVE_TYPES'
CREATE TABLE RELIEF_VALVE_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'CONTACT_MECHANISMS'
CREATE TABLE CONTACT_MECHANISMS
 (COMT_CODE VARCHAR2(80) NOT NULL
 ,CONTACT_VALUE VARCHAR2(240) NOT NULL
 ,ID NUMBER NOT NULL
 )
/

PROMPT Creating Table 'DATA_ITEM_ROLES'
CREATE TABLE DATA_ITEM_ROLES
 (DI_FIELD_NAME VARCHAR2(240) NOT NULL
 ,DI_TABLE_NAME VARCHAR2(240) NOT NULL
 ,ENTY_CODE VARCHAR2(80) NOT NULL
 ,CONDITION VARCHAR2(30) NOT NULL
 ,ERROR_MESSAGE VARCHAR2(80)
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'PARTY_ADDRESS_ROLES'
CREATE TABLE PARTY_ADDRESS_ROLES
 (PADDR_ADDR_CODE VARCHAR2(80) NOT NULL
 ,PADDR_PRTY_ID NUMBER NOT NULL
 ,PADDR_START_DATE DATE NOT NULL
 ,RT_CODE VARCHAR2(80) NOT NULL
 ,START_DATE DATE NOT NULL
 ,END_DATE DATE
 )
/

PROMPT Creating Table 'QUOTE_REASONING'
CREATE TABLE QUOTE_REASONING
 (REASON VARCHAR2(240) NOT NULL
 ,INTERNAL_OR_EXTERNAL VARCHAR2(8) DEFAULT 'EXTERNAL' NOT NULL
 ,ENQU_ID NUMBER
 ,ID NUMBER(*,0) NOT NULL
 )
/

PROMPT Creating Table 'DATA_ITEM_ROLES_IMPORT'
CREATE TABLE DATA_ITEM_ROLES_IMPORT
 (FIELD_NAME VARCHAR2(240)
 ,TABLE_NAME VARCHAR2(240)
 ,INSTALL VARCHAR2(80)
 ,STD_INSTALL VARCHAR2(80)
 ,OFMAT VARCHAR2(80)
 ,EXCHANGE VARCHAR2(80)
 ,STD_EXCHANGE VARCHAR2(80)
 ,REMOVE VARCHAR2(80)
 ,STD_REMOVE VARCHAR2(80)
 ,ADVERSARIAL VARCHAR2(80)
 ,ALTERATION VARCHAR2(80)
 ,CHANGE_CAPACITY VARCHAR2(80)
 ,ADDON VARCHAR2(80)
 ,OTHER VARCHAR2(80)
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'CONNECTION_ORIENTATIONS'
CREATE TABLE CONNECTION_ORIENTATIONS
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'METER_SIZE_CODES'
CREATE TABLE METER_SIZE_CODES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 ,QMAX NUMBER NOT NULL
 ,VALID_FOR_EXISTING_METER VARCHAR2(3) NOT NULL
 ,VALID_FOR_NEW_METER VARCHAR2(3) NOT NULL
 )
/

PROMPT Creating Table 'COSTS'
CREATE TABLE COSTS
 (REGI_CODE VARCHAR2(80)
 ,COST_PRICE NUMBER(*,2)
 ,ADIT_CODE VARCHAR2(240)
 ,VALID_FROM DATE NOT NULL
 ,BAS_CODE VARCHAR2(80)
 ,SELLING_PRICE NUMBER(*,2) NOT NULL
 ,DELIVERY_COST NUMBER(*,2)
 ,VALID_TO DATE
 ,HOU_CODE VARCHAR2(80)
 ,ENTY_CODE VARCHAR2(80)
 ,MESC_CODE VARCHAR2(80)
 ,METY_CODE VARCHAR2(80)
 ,SVCPT_CODE VARCHAR2(80)
 ,METR_CODE VARCHAR2(80)
 ,MODU_CODE VARCHAR2(80)
 ,ID NUMBER NOT NULL
 ,COST_TYPE VARCHAR2(10) NOT NULL
 )
/

PROMPT Creating Table 'REGIONS'
CREATE TABLE REGIONS
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'CONTACT_MECHANISM_TYPES'
CREATE TABLE CONTACT_MECHANISM_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80) NOT NULL
 )
/

PROMPT Creating Table 'DOCUMENTS'
CREATE TABLE DOCUMENTS
 (URI VARCHAR2(400) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 ,ID NUMBER(*,0) NOT NULL
 ,DOCU_TYPE VARCHAR2(10) NOT NULL
 )
/

PROMPT Creating Table 'PARTY_CONTACT_MECHANISM_ROLES'
CREATE TABLE PARTY_CONTACT_MECHANISM_ROLES
 (PCM_COME_ID NUMBER NOT NULL
 ,PCM_PRTY_ID NUMBER NOT NULL
 ,PCM_START_DATE DATE NOT NULL
 ,RT_CODE VARCHAR2(80) NOT NULL
 ,START_DATE DATE NOT NULL
 ,END_DATE DATE
 )
/

PROMPT Creating Table 'FILTERS'
CREATE TABLE FILTERS
 (CODE VARCHAR2(80) NOT NULL
 ,FITY_CODE VARCHAR2(80) NOT NULL
 ,FILTER_SIZE NUMBER NOT NULL
 )
/

PROMPT Creating Table 'QUOTE_ROLES'
CREATE TABLE QUOTE_ROLES
 (PRTY_ID NUMBER NOT NULL
 ,QUTE_ID NUMBER NOT NULL
 ,RT_CODE VARCHAR2(80) NOT NULL
 ,START_DATE DATE DEFAULT SYSDATE NOT NULL
 ,END_DATE DATE
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'PARTY_RELATIONSHIPS'
CREATE TABLE PARTY_RELATIONSHIPS
 (FROM_PARL_ID NUMBER NOT NULL
 ,TO_PARL_ID NUMBER NOT NULL
 ,FROM_PARL_PRTY_ID NUMBER NOT NULL
 ,TO_PARL_PRTY_ID NUMBER NOT NULL
 ,FROM_PARL_RT_CODE VARCHAR2(80) NOT NULL
 ,TO_PARL_RT_CODE VARCHAR2(80) NOT NULL
 ,START_DATE DATE NOT NULL
 ,FROM_PRTP_RT_CODE VARCHAR2(80) NOT NULL
 ,TO_PRTP_RT_CODE VARCHAR2(80) NOT NULL
 ,END_DATE DATE
 )
/

PROMPT Creating Table 'QUOTES'
CREATE TABLE QUOTES
 (ENQU_ID NUMBER NOT NULL
 ,VALID_FROM DATE
 ,VALID_UNTIL DATE
 ,CREATED_ON DATE NOT NULL
 ,CREATED_BY VARCHAR2(80) NOT NULL
 ,UPDATED_ON DATE
 ,UPDATED_BY VARCHAR2(80)
 ,ID NUMBER NOT NULL
 ,QUTE_TYPE VARCHAR2(10) NOT NULL
 )
/

PROMPT Creating Table 'QUOTE_EVENTS'
CREATE TABLE QUOTE_EVENTS
 (QUST_CODE VARCHAR2(80) NOT NULL
 ,QUTE_ID NUMBER NOT NULL
 ,EVENT_DATE DATE NOT NULL
 )
/

PROMPT Creating Table 'SERVICE_PRESSURES'
CREATE TABLE SERVICE_PRESSURES
 (CODE VARCHAR2(80) NOT NULL
 ,SVCPT_CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'PARTY_ADDRESSES'
CREATE TABLE PARTY_ADDRESSES
 (ADDR_CODE VARCHAR2(80) NOT NULL
 ,PRTY_ID NUMBER NOT NULL
 ,START_DATE DATE NOT NULL
 ,END_DATE DATE
 ,COMMENTS VARCHAR2(255)
 )
/

PROMPT Creating Table 'ENQUIRY_EVENTS'
CREATE TABLE ENQUIRY_EVENTS
 (ENQU_ID NUMBER NOT NULL
 ,ENST_CODE VARCHAR2(80) NOT NULL
 ,EVENT_DATE DATE NOT NULL
 )
/

PROMPT Creating Table 'PARTIES'
CREATE TABLE PARTIES
 (MANU_REF VARCHAR2(80)
 ,SHORTCODE VARCHAR2(3)
 ,CREATED_BY VARCHAR2(80) NOT NULL
 ,NAME VARCHAR2(80)
 ,DESCRIPTION VARCHAR2(80)
 ,CREATED_ON DATE NOT NULL
 ,ADVERSARIAL_CONTRACT_REF VARCHAR2(25)
 ,UPDATED_ON DATE
 ,UPDATED_BY VARCHAR2(80)
 ,MKTP_REF VARCHAR2(80)
 ,LT_7B_CONTRACT_REF VARCHAR2(25)
 ,GT_7B_CONTRACT_REF VARCHAR2(25)
 ,TRIPARTITE_MEMBER VARCHAR2(3)
 ,USERNAME VARCHAR2(80)
 ,STATUS VARCHAR2(7)
 ,FIRST_NAME VARCHAR2(80)
 ,LAST_NAME VARCHAR2(80)
 ,PERSONAL_TITLE VARCHAR2(6)
 ,COMMENTS VARCHAR2(255)
 ,ID NUMBER NOT NULL
 ,PRTY_TYPE VARCHAR2(10) NOT NULL
 )
/

PROMPT Creating Table 'POSTCODES'
CREATE TABLE POSTCODES
 (REGI_CODE VARCHAR2(80) NOT NULL
 ,OUTCODE VARCHAR2(4) NOT NULL
 ,INCODE VARCHAR2(3)
 ,ID NUMBER NOT NULL
 )
/

PROMPT Creating Table 'ENQUIRY_TYPES'
CREATE TABLE ENQUIRY_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'DOCUMENT_ROLES'
CREATE TABLE DOCUMENT_ROLES
 (DOCU_ID NUMBER(*,0) NOT NULL
 ,RT_CODE VARCHAR2(80) NOT NULL
 ,START_DATE DATE NOT NULL
 ,END_DATE DATE
 ,DESCRIPTION VARCHAR2(80)
 ,DRWG_CODE VARCHAR2(80)
 ,ENQU_ID NUMBER
 ,QUTE_ID NUMBER
 ,ID NUMBER NOT NULL
 ,DORO_TYPE VARCHAR2(10) NOT NULL
 )
/

PROMPT Creating Table 'DATA_ITEMS'
CREATE TABLE DATA_ITEMS
 (FIELD_NAME VARCHAR2(240) NOT NULL
 ,TABLE_NAME VARCHAR2(240) NOT NULL
 ,DESCRIPTION VARCHAR2(240)
 )
/

PROMPT Creating Table 'QUOTE_ITEMS'
CREATE TABLE QUOTE_ITEMS
 (MODU_CODE VARCHAR2(80)
 ,SELLING_PRICE NUMBER
 ,ENTY_CODE VARCHAR2(80)
 ,QUTE_ID NUMBER NOT NULL
 ,COST_PRICE NUMBER
 ,ADIT_CODE VARCHAR2(240)
 ,BAS_CODE VARCHAR2(80)
 ,SVCPT_CODE VARCHAR2(80)
 ,DELIVERY_PRICE NUMBER
 ,LEAD_TIME NUMBER
 ,HOU_CODE VARCHAR2(80)
 ,MESC_CODE VARCHAR2(80)
 ,METY_CODE VARCHAR2(80)
 ,ID NUMBER(*,0) NOT NULL
 ,QUIT_TYPE VARCHAR2(10) NOT NULL
 )
/

PROMPT Creating Table 'ROLE_TYPES'
CREATE TABLE ROLE_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 ,RT_TYPE VARCHAR2(10) NOT NULL
 )
/

PROMPT Creating Table 'PASSWORDS'
CREATE TABLE PASSWORDS
 (PRTY_ID NUMBER NOT NULL
 ,PASSWORD_HASH VARCHAR2(255) NOT NULL
 ,CREATED_ON DATE NOT NULL
 ,CREATED_BY NUMBER
 )
/

PROMPT Creating Table 'ASSET_LOCATION_TYPES'
CREATE TABLE ASSET_LOCATION_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'METERS'
CREATE TABLE METERS
 (CODE VARCHAR2(80) NOT NULL
 ,METY_CODE VARCHAR2(80) NOT NULL
 ,PRTY_ID NUMBER NOT NULL
 ,DIM_A NUMBER NOT NULL
 ,DIM_B NUMBER NOT NULL
 ,DIM_C NUMBER NOT NULL
 ,CENTRES NUMBER NOT NULL
 ,WEIGHT NUMBER NOT NULL
 ,QMAX NUMBER NOT NULL
 ,QMIN NUMBER NOT NULL
 ,QNOM NUMBER NOT NULL
 ,VALID_FROM DATE NOT NULL
 ,DRWG_CODE VARCHAR2(80)
 ,VALID_TO DATE
 )
/

PROMPT Creating Table 'CONNECTION_TYPES'
CREATE TABLE CONNECTION_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'ERROR_LOGS'
CREATE TABLE ERROR_LOGS
 (ERLO_ID NUMBER NOT NULL
 ,ERROR_TYPE VARCHAR2(25) NOT NULL
 ,SOURCE VARCHAR2(240) NOT NULL
 ,SEVERITY VARCHAR2(1) NOT NULL
 ,ERROR_CODE VARCHAR2(240) NOT NULL
 ,ERROR_MESSAGE VARCHAR2(2000) NOT NULL
 ,ERROR_DATE DATE NOT NULL
 ,ERROR_STATUS VARCHAR2(1)
 ,CREATED_BY NUMBER DEFAULT 0 NOT NULL
 ,CREATED_ON DATE NOT NULL
 ,UPDATED_BY NUMBER
 ,UPDATED_ON DATE NOT NULL
 )
/

COMMENT ON COLUMN ERROR_LOGS.ERROR_TYPE IS 'The type of error.'
/

COMMENT ON COLUMN ERROR_LOGS.SOURCE IS 'The source of the error.'
/

COMMENT ON COLUMN ERROR_LOGS.SEVERITY IS 'The severity of the error.'
/

COMMENT ON COLUMN ERROR_LOGS.ERROR_CODE IS 'The code for the error'
/

COMMENT ON COLUMN ERROR_LOGS.ERROR_MESSAGE IS 'The message from the error'
/

COMMENT ON COLUMN ERROR_LOGS.ERROR_DATE IS 'The date and time the error was logged.'
/

COMMENT ON COLUMN ERROR_LOGS.ERROR_STATUS IS 'The status of the error'
/

COMMENT ON COLUMN ERROR_LOGS.CREATED_BY IS 'The unique indentifier for a user of the system'
/

COMMENT ON COLUMN ERROR_LOGS.UPDATED_BY IS 'The unique indentifier for a user of the system'
/

PROMPT Creating Table 'ENQUIRY_STATUS_TYPES'
CREATE TABLE ENQUIRY_STATUS_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'RELIEF_VALVES'
CREATE TABLE RELIEF_VALVES
 (CODE VARCHAR2(80) NOT NULL
 ,RVTY_CODE VARCHAR2(80) NOT NULL
 ,RELIEF_VALVE_SIZE NUMBER
 ,RELIEF_VALVE_SETTING NUMBER
 )
/

PROMPT Creating Table 'SLAMSHUT_VALVES'
CREATE TABLE SLAMSHUT_VALVES
 (CODE VARCHAR2(80) NOT NULL
 ,SLTY_CODE VARCHAR2(80) NOT NULL
 ,SLAMSHUT_SIZE NUMBER
 ,SLAMSHUT_SETTING NUMBER NOT NULL
 )
/

PROMPT Creating Table 'ENQUIRY_ROLES'
CREATE TABLE ENQUIRY_ROLES
 (ENQU_ID NUMBER NOT NULL
 ,PRTY_ID NUMBER NOT NULL
 ,RT_CODE VARCHAR2(80) NOT NULL
 ,START_DATE DATE DEFAULT SYSDATE NOT NULL
 ,END_DATE DATE
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'BASES'
CREATE TABLE BASES
 (CODE VARCHAR2(80) NOT NULL
 ,DRWG_CODE VARCHAR2(80)
 ,DESCRIPTION VARCHAR2(80)
 ,DIM_A NUMBER
 ,DIM_B NUMBER
 ,DIM_C NUMBER
 ,DIM_D NUMBER
 ,DIM_E NUMBER
 ,DIM_F NUMBER
 ,DIM_G NUMBER
 ,DIM_H NUMBER
 ,DIM_I NUMBER
 ,DEPTH NUMBER
 )
/

PROMPT Creating Table 'HOUSING_TYPES'
CREATE TABLE HOUSING_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'SLAMSHUT_TYPES'
CREATE TABLE SLAMSHUT_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'ENQUIRIES'
CREATE TABLE ENQUIRIES
 (ID NUMBER NOT NULL
 ,FIRST_CONTACT_FAX VARCHAR2(15)
 ,FIRST_CONTACT_EMAIL VARCHAR2(240)
 ,SECOND_CONTACT_TELEPHONE_1 VARCHAR2(15)
 ,SECOND_CONTACT_FAX VARCHAR2(15)
 ,INSTALL_BUILDING VARCHAR2(40)
 ,INSTALL_CITY VARCHAR2(40)
 ,INSTALL_POSTCODE VARCHAR2(8)
 ,SECOND_ALT_SUB_BUILDING VARCHAR2(40)
 ,FIRST_ALT_BUILDING VARCHAR2(40)
 ,SECOND_ALT_STREET VARCHAR2(60)
 ,SECOND_ALT_CITY VARCHAR2(40)
 ,SECOND_ALT_POSTCODE VARCHAR2(8)
 ,ASSET_LOCATION_NOTES VARCHAR2(100)
 ,MPRN NUMBER(30,0)
 ,REQUIRED_METERING_PRESSURE NUMBER
 ,REQUIRED_IP_DETAILS VARCHAR2(250)
 ,REQUIRED_IP_MBAR NUMBER
 ,HOUSING_REQUIRED VARCHAR2(3)
 ,BASE_REQUIRED VARCHAR2(3)
 ,TWIN_STREAM_REQUIRED VARCHAR2(3)
 ,QMAX NUMBER
 ,EXISTING_METER_MODEL VARCHAR2(10)
 ,OTHER_INFORMATION VARCHAR2(250)
 ,ALTY_CODE VARCHAR2(80)
 ,CACA_CODE VARCHAR2(80)
 ,ENTY_CODE VARCHAR2(80)
 ,EXISTING_MESC_CODE VARCHAR2(80)
 ,METY_CODE VARCHAR2(80)
 ,REQUIRED_MESC_CODE VARCHAR2(80)
 ,REQUIRED_SVCP_CODE VARCHAR2(80)
 ,AGENT_CONTACT_VALUE VARCHAR2(240)
 ,TRANSACTION_REFERENCE VARCHAR2(80)
 ,FIRST_CONTACT_NAME VARCHAR2(80)
 ,SECOND_CONTACT_TELEPHONE_2 VARCHAR2(15)
 ,SECOND_CONTACT_EMAIL VARCHAR2(240)
 ,INSTALL_SUB_BUILDING VARCHAR2(40)
 ,INSTALL_STREET VARCHAR2(60)
 ,SECOND_CONTACT_NAME VARCHAR2(80)
 ,FIRST_ALT_STREET VARCHAR2(60)
 ,FIRST_ALT_CITY VARCHAR2(40)
 ,FIRST_ALT_POSTCODE VARCHAR2(8)
 ,SECOND_ALT_BUILDING VARCHAR2(40)
 ,ACCESS_PASSWORD VARCHAR2(30)
 ,ACCESS_ADDITIONAL VARCHAR2(210)
 ,INDICATIVE_DATE DATE
 ,INDICATIVE_TIME VARCHAR2(2) DEFAULT 'DY'
 ,OTHER_PROJECT_REFERENCE VARCHAR2(50)
 ,CONVERTOR_REQUIRED VARCHAR2(3)
 ,AMR_REQUIRED VARCHAR2(3)
 ,EMS_REQUIRED VARCHAR2(3)
 ,BYPASS_REQUIRED VARCHAR2(40)
 ,BYPASS_OTHER VARCHAR2(40)
 ,LOGGER_REQUIRED VARCHAR2(3)
 ,LOAD_CONTROL_TYPE VARCHAR2(10)
 ,EXISTING_METER_ASSET_PROVIDER VARCHAR2(210)
 ,MARKET_SECTOR_CODE VARCHAR2(1) DEFAULT 'I'
 ,JOB_DESCRIPTION VARCHAR2(500)
 ,AGENT_COMT_CODE VARCHAR2(80)
 ,FIRST_CONTACT_TELEPHONE_1 VARCHAR2(15)
 ,FIRST_CONTACT_TELEPHONE_2 VARCHAR2(15)
 ,FIRST_ALT_SUB_BUILDING VARCHAR2(40)
 ,MPRN_ALT VARCHAR2(250)
 ,ANNUAL_QUANTITY NUMBER
 ,DOWNSTREAM_BOOSTER_OR_COMPRESS VARCHAR2(3)
 ,QMIN NUMBER
 ,EXISTING_METER_SERIAL_NO VARCHAR2(14)
 ,EXISTING_METER_OWNER VARCHAR2(1)
 )
/

PROMPT Creating Table 'PARTY_RELATIONSHIP_TYPES'
CREATE TABLE PARTY_RELATIONSHIP_TYPES
 (TO_RT_CODE VARCHAR2(80) NOT NULL
 ,FROM_RT_CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'APEX_AUTHORIZATION'
CREATE TABLE APEX_AUTHORIZATION
 (RT_CODE VARCHAR2(80) NOT NULL
 ,COMPONENT_NAME VARCHAR2(80) NOT NULL
 ,COMPONENT_TYPE VARCHAR2(1) DEFAULT 'P' NOT NULL
 ,PRIVILEGE VARCHAR2(1) DEFAULT 'A' NOT NULL
 )
/

PROMPT Creating Table 'METER_TYPES'
CREATE TABLE METER_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'MODULES'
CREATE TABLE MODULES
 (CODE VARCHAR2(80) NOT NULL
 ,DRWG_CODE VARCHAR2(80) NOT NULL
 ,FLTR_CODE VARCHAR2(80) NOT NULL
 ,INLET_CNOR_CODE VARCHAR2(80) NOT NULL
 ,INLET_CNTY_CODE VARCHAR2(80) NOT NULL
 ,METR_CODE VARCHAR2(80) NOT NULL
 ,OUTLET_CNOR_CODE VARCHAR2(80) NOT NULL
 ,OUTLET_CNTY_CODE VARCHAR2(80) NOT NULL
 ,PRTY_ID NUMBER NOT NULL
 ,REGU_CODE VARCHAR2(80) NOT NULL
 ,REVA_CODE VARCHAR2(80) NOT NULL
 ,SLVA_CODE VARCHAR2(80) NOT NULL
 ,SVCP_CODE VARCHAR2(80) NOT NULL
 ,LEAD_TIME NUMBER
 ,WEIGHT NUMBER NOT NULL
 ,INLET_HEIGHT NUMBER NOT NULL
 ,INLET_SIZE NUMBER NOT NULL
 ,OUTLET_PRESSURE NUMBER NOT NULL
 ,OUTLET_HEIGHT NUMBER NOT NULL
 ,OUTLET_SIZE NUMBER NOT NULL
 ,DIM_A NUMBER NOT NULL
 ,DIM_B NUMBER NOT NULL
 ,DIM_C NUMBER NOT NULL
 ,DIM_D NUMBER NOT NULL
 ,DIM_E NUMBER NOT NULL
 ,DIM_H NUMBER NOT NULL
 ,VALID_FROM DATE NOT NULL
 ,BAS_CODE VARCHAR2(80)
 ,HOU_CODE VARCHAR2(80)
 ,VALID_TO DATE
 )
/

COMMENT ON COLUMN MODULES.PRTY_ID IS 'Manufacturer of the module'
/

PROMPT Creating Table 'HOUSINGS'
CREATE TABLE HOUSINGS
 (CODE VARCHAR2(80) NOT NULL
 ,DRWG_CODE VARCHAR2(80) NOT NULL
 ,HOTY_CODE VARCHAR2(80) NOT NULL
 ,PRTY_ID NUMBER NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 ,DIM_L NUMBER NOT NULL
 ,DIM_W NUMBER NOT NULL
 ,DIM_H NUMBER NOT NULL
 ,WEIGHT NUMBER NOT NULL
 )
/

PROMPT Creating Table 'REGULATOR_TYPES'
CREATE TABLE REGULATOR_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'BYPASS_REASONS'
CREATE TABLE BYPASS_REASONS
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'REGI_ENQU_EXCLUSIONS'
CREATE TABLE REGI_ENQU_EXCLUSIONS
 (ENTY_CODE VARCHAR2(80) NOT NULL
 ,REGI_CODE VARCHAR2(80) NOT NULL
 ,COST_ID NUMBER
 ,ID NUMBER(*,0) NOT NULL
 )
/

PROMPT Creating Table 'FILTER_TYPES'
CREATE TABLE FILTER_TYPES
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'EXCEPTION_MESSAGES'
CREATE TABLE EXCEPTION_MESSAGES
 (EXCEPTION_NUMBER NUMBER NOT NULL
 ,MESSAGE VARCHAR2(400) NOT NULL
 ,EXME_TYPE VARCHAR2(1) NOT NULL
 ,CREATED_BY NUMBER
 ,CREATED_ON DATE NOT NULL
 ,EXME_COMMENT VARCHAR2(1024)
 ,UPDATED_BY NUMBER
 ,UPDATED_ON DATE
 )
/

PROMPT Creating Table 'ADDITIONAL_ITEMS'
CREATE TABLE ADDITIONAL_ITEMS
 (CODE VARCHAR2(240) NOT NULL
 ,DESCRIPTION VARCHAR2(240)
 ,LEAD_TIME VARCHAR2(240)
 )
/

PROMPT Creating Table 'DRAWINGS'
CREATE TABLE DRAWINGS
 (CODE VARCHAR2(80) NOT NULL
 ,DESCRIPTION VARCHAR2(80)
 )
/

PROMPT Creating Table 'ADDRESSES'
CREATE TABLE ADDRESSES
 (CODE VARCHAR2(80) NOT NULL
 ,SUB_BUILDING VARCHAR2(40)
 ,BUILDING VARCHAR2(40) NOT NULL
 ,STREET VARCHAR2(60) NOT NULL
 ,CITY VARCHAR2(40) NOT NULL
 ,POSTCODE VARCHAR2(8) NOT NULL
 )
/

PROMPT Creating Table 'PARTY_ROLES'
CREATE TABLE PARTY_ROLES
 (PRTY_ID NUMBER NOT NULL
 ,RT_CODE VARCHAR2(80) NOT NULL
 ,ID NUMBER NOT NULL
 ,START_DATE DATE
 ,END_DATE DATE
 ,DESCRIPTION VARCHAR2(80)
 )
/

