FAXTEL CHAR(7) NULL,

MODEMTEL CHAR(7) NULL,

NAMEADD_ID NUMBER(7) NOT NULL,

DATEADD DATE NOT NULL,

NAMEINS_ID NUMBER(7) NOT NULL,

DATEINS DATE NOT NULL,

PRIM VARCHAR2(200) NULL

);

CREATE UNIQUE INDEX IPKOBECONOM

ON OBECONOM

(

OBJECT_ID ASC

);

CREATE INDEX IFKPEOBECONOM

ON OBECONOM

(

PECULIAR_ID ASC

);

CREATE INDEX IFKRIOBECONOM

ON OBECONOM

(

RISK_ID ASC

);

CREATE INDEX IFKPROBECONOM

ON OBECONOM

(

PROPERTY_ID ASC

);

CREATE INDEX IFKACOBECONOM

ON OBECONOM

(

ACTIVITY_ID ASC

);

CREATE INDEX IFKREOBECONOM

ON OBECONOM

(

REGION_ID ASC

);

CREATE INDEX IFKDEOBECONOM

ON OBECONOM

(

DEPARTAMENT_ID ASC

);

CREATE INDEX IFKPOOBECONOM

ON OBECONOM

(

POST_ID ASC

);

CREATE INDEX IFKPGOBECONOM

ON OBECONOM

(

POSTGO_ID ASC

);

ALTER TABLE OBECONOM

ADD ( PRIMARY KEY (OBJECT_ID) ) ;

CREATE TABLE ORAUSER

(ORAUSER_ID INTEGER NOT NULL,

GOBASEUSER_ID NUMBER(7) NOT NULL

);

CREATE UNIQUE INDEX IPKORAUSER

ON ORAUSER

(

ORAUSER_ID ASC

);

CREATE INDEX IFKGORAUSER

ON ORAUSER

(

GOBASEUSER_ID ASC

);

ALTER TABLE ORAUSER

ADD ( PRIMARY KEY (ORAUSER_ID) ) ;

CREATE TABLE PECULIAR

(PECULIAR_ID NUMBER(7) NOT NULL,

PECULIAR_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKPECULIAR

ON PECULIAR

(

PECULIAR_ID ASC

);

ALTER TABLE PECULIAR

ADD ( PRIMARY KEY (PECULIAR_ID) ) ;

CREATE TABLE POST

(POST_ID NUMBER(7) NOT NULL,

POST_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKPOST

ON POST

(

POST_ID ASC

);

ALTER TABLE POST

ADD ( PRIMARY KEY (POST_ID) ) ;

CREATE TABLE POSTGO

(POSTGO_ID NUMBER(7) NOT NULL,

POSTGO_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKPOSTGO

ON POSTGO

(

POSTGO_ID ASC

);

ALTER TABLE POSTGO

ADD ( PRIMARY KEY (POSTGO_ID) ) ;

CREATE TABLE PROPERTY

(PROPERTY_ID NUMBER(7) NOT NULL,

PROPERTY_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKPROPERTY

ON PROPERTY

(

PROPERTY_ID ASC

);

ALTER TABLE PROPERTY

ADD ( PRIMARY KEY (PROPERTY_ID) ) ;

CREATE TABLE READY

(READY_ID NUMBER(7) NOT NULL,

READY_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKREADY

ON READY

(

READY_ID ASC

);

ALTER TABLE READY

ADD ( PRIMARY KEY (READY_ID) ) ;

CREATE TABLE REGION

(REGION_ID NUMBER(7) NOT NULL,

REGION_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKREGION

ON REGION

(

REGION_ID ASC

);

ALTER TABLE REGION

ADD ( PRIMARY KEY (REGION_ID) ) ;

CREATE TABLE RISK

(RISK_ID NUMBER(7) NOT NULL,

RISK_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKRISK

ON RISK

(

RISK_ID ASC

);

ALTER TABLE RISK

ADD ( PRIMARY KEY (RISK_ID) ) ;

CREATE TABLE SERVIS

(SERVIS_ID NUMBER(7) NOT NULL,

SERVIS_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKSERVIS

ON SERVIS

(

SERVIS_ID ASC

);

ALTER TABLE SERVIS

ADD ( PRIMARY KEY (SERVIS_ID) ) ;

CREATE TABLE SPOST

(SPOST_ID NUMBER(7) NOT NULL,

SPOST_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKSPOST

ON SPOST

(

SPOST_ID ASC

);

ALTER TABLE SPOST

ADD ( PRIMARY KEY (SPOST_ID) ) ;

CREATE TABLE STUDY

(STUDY_ID NUMBER(9) NOT NULL,

OBJECT_ID NUMBER(9) NOT NULL,

SPOST_ID NUMBER(7) NOT NULL,

CATEGORY_ID NUMBER(7) NOT NULL,

NAME VARCHAR2(50) NULL,

WORKTEL CHAR(7) NULL,

LASTDATE DATE NOT NULL,

NEXTDATE DATE NOT NULL,

NAMEADD_ID NUMBER(7) NOT NULL,

DATEADD DATE NOT NULL,

NAMEINS_ID NUMBER(7) NOT NULL,

DATEINS DATE NOT NULL,

PRIM VARCHAR2(200) NULL

);

CREATE UNIQUE INDEX IPKSTUDY

ON STUDY

(

STUDY_ID ASC

);

CREATE INDEX IFKCASTUDY

ON STUDY

(

CATEGORY_ID ASC

);

CREATE INDEX IFKOBSTUDY

ON STUDY

(

OBJECT_ID ASC

);

CREATE INDEX IFKSPSTUDY

ON STUDY

(

SPOST_ID ASC

);

ALTER TABLE STUDY

ADD ( PRIMARY KEY (STUDY_ID) ) ;

CREATE TABLE TEHNICA

(TEHNICA_ID NUMBER(7) NOT NULL,

TEHNICA_CHAR VARCHAR2(50) NULL

);

CREATE UNIQUE INDEX IPKTEHNICA

ON TEHNICA

(

TEHNICA_ID ASC

);

ALTER TABLE TEHNICA

ADD ( PRIMARY KEY (TEHNICA_ID) ) ;

CREATE TABLE TEHNICAOB

(OBJECT_ID NUMBER(9) NOT NULL,

TEHNICA_ID NUMBER(7) NOT NULL,

TEHNICANUM NUMBER(9) NULL,

NAMEADD_ID NUMBER(7) NOT NULL,

DATEADD DATE NOT NULL,

NAMEINS_ID NUMBER(7) NOT NULL,

DATEINS DATE NOT NULL,

PRIM VARCHAR2(100) NULL

);

CREATE UNIQUE INDEX IPKTEHNICOB

ON TEHNICAOB

(

OBJECT_ID ASC,

TEHNICA_ID ASC

);

CREATE INDEX IFKTETEHNICAOB

ON TEHNICAOB

(

TEHNICA_ID ASC

);

CREATE INDEX IFKOBTEHNICAOB

ON TEHNICAOB

(

OBJECT_ID ASC

);

ALTER TABLE TEHNICAOB

ADD ( PRIMARY KEY (OBJECT_ID, TEHNICA_ID) ) ;

CREATE TABLE TEMA

(TEMA_ID NUMBER(7) NOT NULL,

TEMA_CHAR VARCHAR2(255) NULL

);

CREATE UNIQUE INDEX IPKTEMA

ON TEMA

(

TEMA_ID ASC

);

ALTER TABLE TEMA

ADD ( PRIMARY KEY (TEMA_ID) ) ;

ALTER TABLE BUILDINGOB

ADD ( FOREIGN KEY (BUILDING_ID)

REFERENCES BUILDING ) ;

ALTER TABLE BUILDINGOB

ADD ( FOREIGN KEY (OBJECT_ID)

REFERENCES OBECONOM ) ;

ALTER TABLE CATTEMA

ADD ( FOREIGN KEY (CATEGORY_ID)

REFERENCES CATEGORY ) ;

ALTER TABLE CATTEMA

ADD ( FOREIGN KEY (TEMA_ID)

REFERENCES TEMA ) ;

ALTER TABLE FORMIROVOB

ADD ( FOREIGN KEY (READY_ID)

REFERENCES READY ) ;

ALTER TABLE FORMIROVOB

ADD ( FOREIGN KEY (OBJECT_ID)

REFERENCES OBECONOM ) ;

ALTER TABLE FORMIROVOB

ADD ( FOREIGN KEY (FORMIROV_ID)

REFERENCES FORMIROV ) ;

ALTER TABLE MATERIALOB

ADD ( FOREIGN KEY (MATERIAL_ID)

REFERENCES MATERIAL ) ;

ALTER TABLE MATERIALOB

ADD ( FOREIGN KEY (OBJECT_ID)

REFERENCES OBECONOM ) ;

ALTER TABLE MATTEH

ADD ( FOREIGN KEY (SERVIS_ID)

REFERENCES SERVIS ) ;

ALTER TABLE MATTEHOB

ADD ( FOREIGN KEY (MATTEH_ID)

REFERENCES MATTEH ) ;

ALTER TABLE MATTEHOB

ADD ( FOREIGN KEY (OBJECT_ID)

REFERENCES OBECONOM ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (POSTGO_ID)

REFERENCES POSTGO ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (POST_ID)

REFERENCES POST ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (DEPARTAMENT_ID)

REFERENCES DEPARTAMENT ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (REGION_ID)

REFERENCES REGION ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (ACTIVITY_ID)

REFERENCES ACTIVITY ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (PROPERTY_ID)

REFERENCES PROPERTY ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (RISK_ID)

REFERENCES RISK ) ;

ALTER TABLE OBECONOM

ADD ( FOREIGN KEY (PECULIAR_ID)

REFERENCES PECULIAR ) ;

ALTER TABLE ORAUSER

ADD ( FOREIGN KEY (GOBASEUSER_ID)

REFERENCES GOBASEUSER ) ;

ALTER TABLE STUDY

ADD ( FOREIGN KEY (SPOST_ID)

REFERENCES SPOST ) ;

ALTER TABLE STUDY

ADD ( FOREIGN KEY (OBJECT_ID)

REFERENCES OBECONOM ) ;

ALTER TABLE STUDY

ADD ( FOREIGN KEY (CATEGORY_ID)

REFERENCES CATEGORY ) ;

ALTER TABLE TEHNICAOB

ADD ( FOREIGN KEY (OBJECT_ID)

REFERENCES OBECONOM ) ;

ALTER TABLE TEHNICAOB

ADD ( FOREIGN KEY (TEHNICA_ID)

REFERENCES TEHNICA ) ;

/

DROP INDEX IFKGORAUSER;

CREATE UNIQUE INDEX IFKGORAUSER

ON ORAUSER

(

GOBASEUSER_ID ASC

);

DROP INDEX IFKNOOBECONOM;

CREATE UNIQUE INDEX IFKNOOBECONOM

ON OBECONOM

(

OBJECTNO ASC

);

/

ALTER TABLE GO.OBECONOM ADD )