object tables relation ships

81 Views Asked by At

I am newbie in OODB. I have been trying to solve this task for several days. It just doesn't work out whether, someone can help me and write a small example for understanding?

Task:

Create 3 object tables with nested objects (object in object).

  • The first object table is linked to the second object table using a 1: 1 relationship (using REF and DEREF).
  • The second object table is linked to the third object table by a 1: N relationship (an intermediate table with a reference collection REF is used).

I want to make 3 object tables: WORKERS, POSITIONS, PERSONAL DATAS

Relation:

WORKERS 1:N POSITION

WORKERS 1:1 PERSONAL DATA

CREATE OR REPLACE TYPE T_POSITION AS OBJECT(
    TITLE   VARCHAR2(30),
    SALARY  FLOAT
);

CREATE OR REPLACE TYPE O_POSITION AS OBJECT(
    ID          INT,
    O_POSITION  T_POSITION
);

CREATE TABLE X_POSITIONS OF O_POSITION(
ID PRIMARY KEY)
OBJECT IDENTIFIER IS PRIMARY KEY;

CREATE TABLE T_REL(
    POSITION REF O_POSITION SCOPE IS X_POSITIONS
);


CREATE OR REPLACE TYPE T_WORKER AS OBJECT(
    NAME    VARCHAR2(30),
    SURNAME VARCHAR2(30)
);

CREATE OR REPLACE TYPE O_WORKER AS OBJECT(
    ID      INT,
    O_WORKER T_WORKER,
    POSITION_ID # Here is some ref i think
);
0

There are 0 best solutions below