(

FOREIGN KEY ( GLAVOBJECT_ID )

REFERENCES

GO.OBECONOM(OBJECT_ID)

);

ALTER TABLE GO.STUDY ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.STUDY ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.OBECONOM ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.OBECONOM ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.MATERIALOB ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.MATERIALOB ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.BUILDINGOB ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.BUILDINGOB ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.TEHNICAOB ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.TEHNICAOB ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.FORMIROVOB ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.FORMIROVOB ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.MATTEHOB ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.MATTEHOB ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.CATTEMA ADD

(

FOREIGN KEY ( NAMEADD_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

ALTER TABLE GO.CATTEMA ADD

(

FOREIGN KEY ( NAMEINS_ID )

REFERENCES

GO.GOBASEUSER(GOBASEUSER_ID)

);

/

CREATE TRIGGER IU_STUDY BEFORE INSERT OR UPDATE ON GO.STUDY

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE TRIGGER IU_OBECONOM BEFORE INSERT OR UPDATE ON GO.OBECONOM

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE TRIGGER IU_MATERIALOB BEFORE INSERT OR UPDATE ON GO.MATERIALOB

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE TRIGGER IU_BUILDINGOB BEFORE INSERT OR UPDATE ON GO.BUILDINGOB

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE TRIGGER IU_FORMIROVOB BEFORE INSERT OR UPDATE ON GO.FORMIROVOB

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE TRIGGER IU_TEHNICAOB BEFORE INSERT OR UPDATE ON GO.TEHNICAOB

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE TRIGGER IU_MATTEHOB BEFORE INSERT OR UPDATE ON GO.MATTEHOB

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE TRIGGER IU_CATTEMA BEFORE INSERT OR UPDATE ON GO.CATTEMA

FOR EACH ROW

BEGIN

IF INSERTING THEN

SELECT GOBASEUSER_ID INTO :NEW.NAMEADD_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEADD := SYSDATE;

END IF;

SELECT GOBASEUSER_ID INTO :NEW.NAMEINS_ID

FROM GO.ORAUSER

WHERE ORAUSER_ID=UID;

:NEW.DATEINS := SYSDATE;

END;

/

CREATE SEQUENCE S_STUDY;

CREATE SEQUENCE S_CATEGORY;

CREATE SEQUENCE S_TEMA;

CREATE SEQUENCE S_SPOST;

CREATE SEQUENCE S_OBECONOM;

CREATE SEQUENCE S_PECULIAR;

CREATE SEQUENCE S_REGION;

CREATE SEQUENCE S_RISK;

CREATE SEQUENCE S_DEPARTAMENT;

CREATE SEQUENCE S_PROPERTY;

CREATE SEQUENCE S_ACTIVITY;

CREATE SEQUENCE S_POST;

CREATE SEQUENCE S_POSTGO;

CREATE SEQUENCE S_MATERIAL;

CREATE SEQUENCE S_BUILDING;

CREATE SEQUENCE S_TEHNICA;

CREATE SEQUENCE S_MATTEH;

CREATE SEQUENCE S_SERVIS;

CREATE SEQUENCE S_FORMIROV;

CREATE SEQUENCE S_READY;

/

)