create table DT963 (
    "UUID" raw(16),
    "PR_ID" varchar2(18 char),
    "PSP_ID" varchar2(18 char),
    "PARENT_PSP" raw(16),
    "PSP_NAME" varchar2(50 char),
    "CREATED_ON" date,
    "MODIFIED_ON" date,
    "RWDU" number(5,0),
    "CREATED_BY" varchar2(20 char),
    "MODIFIED_BY" varchar2(20 char),
    "OWN_LIC" varchar2(4 char),
    "OPC" varchar2(8 char),
    "OWNER" number(5,0),
    "GROUP" number(5,0),
    "ANY" number(5,0),
    "EFFORT_PLAN" NUMBER(20,0),
    "EFFORT_ACT" NUMBER(20,0),
    "EFFORT_REM" NUMBER(20,0),
    "COSTS_PLAN" NUMBER(20,0),
    "COSTS_ACT" NUMBER(20,0),
    "COSTS_REM" NUMBER(20,0),
    "EFFORT_PLAN_SUM" NUMBER(20,0),
    "EFFORT_ACT_SUM" NUMBER(20,0),
    "EFFORT_REM_SUM" NUMBER(20,0),
    "COSTS_PLAN_SUM" NUMBER(20,0),
    "COSTS_ACT_SUM" NUMBER(20,0),
    "COSTS_REM_SUM" NUMBER(20,0),
    "PERSON_RESP" varchar2(20 char),
    "STATUS" number(5,0)
);

alter table DT963 add constraint PID963DT963 primary key ("UUID");



alter table DT963
    add constraint FKDT963ID461
    foreign key ("PR_ID")
    references DT461
    on delete cascade
    deferrable
    novalidate;
alter table DT963 enable validate constraint FKDT963ID461;

alter table DT963
    add constraint FKDT963ID963S
    foreign key ("PARENT_PSP")
    references DT963
    on delete cascade
    deferrable
    novalidate;
alter table DT963 enable validate constraint FKDT963ID963S;

create index IDX_DT963ID461 on DT963 ("PR_ID");

create index IDX_DT963ID963S on DT963 ("PARENT_PSP");

alter table DT963 MODIFY ("UUID" DEFAULT SYS_GUID());

alter table DT963
    add constraint DT963UUID_NOT_NULL check("UUID" is not null);

alter table DT963
    add constraint DT963PR_ID_NOT_NULL check("PR_ID" is not null);

alter table DT963 MODIFY ("CREATED_ON" DEFAULT TO_DATE('01.01.1970','DD.MM.YYYY'));

alter table DT963 MODIFY ("MODIFIED_ON" DEFAULT TO_DATE('01.01.1970','DD.MM.YYYY'));

alter table DT963 MODIFY ("RWDU" DEFAULT 0);

alter table DT963 MODIFY ("OWNER" DEFAULT 0);

alter table DT963 MODIFY ("GROUP" DEFAULT 0);

alter table DT963 MODIFY ("ANY" DEFAULT 0);

alter table DT963 MODIFY ("EFFORT_PLAN" DEFAULT 0);

alter table DT963 MODIFY ("EFFORT_ACT" DEFAULT 0);

alter table DT963 MODIFY ("EFFORT_REM" DEFAULT 0);

alter table DT963 MODIFY ("COSTS_PLAN" DEFAULT 0);

alter table DT963 MODIFY ("COSTS_ACT" DEFAULT 0);

alter table DT963 MODIFY ("COSTS_REM" DEFAULT 0);

alter table DT963 MODIFY ("EFFORT_PLAN_SUM" DEFAULT 0);

alter table DT963 MODIFY ("EFFORT_ACT_SUM" DEFAULT 0);

alter table DT963 MODIFY ("EFFORT_REM_SUM" DEFAULT 0);

alter table DT963 MODIFY ("COSTS_PLAN_SUM" DEFAULT 0);

alter table DT963 MODIFY ("COSTS_ACT_SUM" DEFAULT 0);

alter table DT963 MODIFY ("COSTS_REM_SUM" DEFAULT 0);

alter table DT963 MODIFY ("STATUS" DEFAULT 0);

create table DT974 (
    "UUID" raw(16),
    "PR_ID" varchar2(18 char),
    "REPORT_ID" varchar2(10 char),
    "PSP_ID" varchar2(18 char),
    "PSP_NAME" varchar2(50 char),
    "PARENT_PSP" raw(16),
    "CREATED_ON" date,
    "MODIFIED_ON" date,
    "RWDU" number(5,0),
    "CREATED_BY" varchar2(20 char),
    "MODIFIED_BY" varchar2(20 char),
    "OWN_LIC" varchar2(4 char),
    "OPC" varchar2(8 char),
    "OWNER" number(5,0),
    "GROUP" number(5,0),
    "ANY" number(5,0),
    "EFFORT_PLAN" number,
    "EFFORT_ACT" number,
    "EFFORT_REM" number,
    "COSTS_PLAN" number,
    "COSTS_ACT" number,
    "COSTS_REM" number,
    "EFFORT_PLAN_SUM" number,
    "EFFORT_ACT_SUM" number,
    "EFFORT_REM_SUM" number,
    "COSTS_PLAN_SUM" number,
    "COSTS_ACT_SUM" number,
    "COSTS_REM_SUM" number,
    "PERSON_RESP" varchar2(20 char),
    "STATUS" number(5,0)
);

alter table DT974 add constraint PID974DT974 primary key ("UUID", "PR_ID", "REPORT_ID");

alter table DT974
    add constraint FKDT974ID974S
    foreign key ("PARENT_PSP", "PR_ID", "REPORT_ID")
    references DT974
    on delete cascade
    deferrable
    novalidate;
alter table DT974 enable validate constraint FKDT974ID974S;

alter table DT974
    add constraint FKDT974ID461
    foreign key ("PR_ID")
    references DT461
    on delete cascade
    deferrable
    novalidate;
alter table DT974 enable validate constraint FKDT974ID461;

alter table DT974
    add constraint FKDT974ID823
    foreign key ("PR_ID", "REPORT_ID")
    references DT823
    on delete cascade
    deferrable
    novalidate;
alter table DT974 enable validate constraint FKDT974ID823;

create index IDX_DT974ID974S on DT974 ("PARENT_PSP", "PR_ID", "REPORT_ID");

create index IDX_DT974ID461 on DT974 ("PR_ID");

create index IDX_DT974ID823 on DT974 ("PR_ID", "REPORT_ID");

alter table DT974 MODIFY ("UUID" DEFAULT SYS_GUID());

alter table DT974
    add constraint DT974UUID_NOT_NULL check("UUID" is not null);

alter table DT974
    add constraint DT974PR_ID_NOT_NULL check("PR_ID" is not null);

alter table DT974
    add constraint DT974REPORT_ID_NOT_NULL check("REPORT_ID" is not null);

alter table DT974
    add constraint DT974PARENT_PSP_NOT_NULL check("PARENT_PSP" is not null);

alter table DT974 MODIFY ("CREATED_ON" DEFAULT TO_DATE('01.01.1970','DD.MM.YYYY'));

alter table DT974 MODIFY ("MODIFIED_ON" DEFAULT TO_DATE('01.01.1970','DD.MM.YYYY'));

alter table DT974 MODIFY ("RWDU" DEFAULT 0);

alter table DT974 MODIFY ("OWNER" DEFAULT 0);

alter table DT974 MODIFY ("GROUP" DEFAULT 0);

alter table DT974 MODIFY ("ANY" DEFAULT 0);

alter table DT974 MODIFY ("EFFORT_PLAN" DEFAULT 0);

alter table DT974 MODIFY ("EFFORT_ACT" DEFAULT 0);

alter table DT974 MODIFY ("EFFORT_REM" DEFAULT 0);

alter table DT974 MODIFY ("COSTS_PLAN" DEFAULT 0);

alter table DT974 MODIFY ("COSTS_ACT" DEFAULT 0);

alter table DT974 MODIFY ("COSTS_REM" DEFAULT 0);

alter table DT974 MODIFY ("EFFORT_PLAN_SUM" DEFAULT 0);

alter table DT974 MODIFY ("EFFORT_ACT_SUM" DEFAULT 0);

alter table DT974 MODIFY ("EFFORT_REM_SUM" DEFAULT 0);

alter table DT974 MODIFY ("COSTS_PLAN_SUM" DEFAULT 0);

alter table DT974 MODIFY ("COSTS_ACT_SUM" DEFAULT 0);

alter table DT974 MODIFY ("COSTS_REM_SUM" DEFAULT 0);

alter table DT974 MODIFY ("STATUS" DEFAULT 0);

alter table DT463 add SAP_STRUCTURE raw(16);

alter table DT824 add SAP_STRUCTURE raw(16);

alter table DT963 add EFFORT_TOTAL number;

alter table DT963 MODIFY ("EFFORT_TOTAL" DEFAULT 0);

alter table DT963 add COST_TOTAL number;

alter table DT963 MODIFY ("COST_TOTAL" DEFAULT 0);

alter table DT974 add EFFORT_TOTAL number;

alter table DT974 MODIFY ("EFFORT_TOTAL" DEFAULT 0);

alter table DT974 add COST_TOTAL number;

alter table DT974 MODIFY ("COST_TOTAL" DEFAULT 0);

create table SAPPOOL (
    "UUID" raw(16),
    "CONFIG_ID" raw(16),
    "CREATED_ID" raw(16),
    "PSP_ID" varchar2(18 char),
    "PSP_NAME" varchar2(30 char),
    "PARENT_PSP_ID" varchar2(18 char),
    "PR_ID" varchar2(18 char),
    "CREATED_ON" date,
    "MODIFIED_ON" date,
    "RWDU" number(5,0),
    "CREATED_BY" varchar2(20 char),
    "MODIFIED_BY" varchar2(20 char),
    "OWN_LIC" varchar2(4 char),
    "OPC" varchar2(8 char),
    "OWNER_DI" number(5,0),
    "GROUP_DI" number(5,0),
    "ANY_DI" number(5,0),
    "COST_PLAN" number,
    "COST_ACT" number,
    "COST_REM" number,
    "EFFORT_PLAN" number,
    "EFFORT_ACT" number,
    "EFFORT_REM" number,
    "PERSON_RESP" varchar2(20 char),
    "STATUS" number(5,0),
    "TRANSFERRED_ON" varchar2(80 char)
);

alter table SAPPOOL add constraint PID964DT964 primary key ("UUID");

alter table SAPPOOL
    add constraint FKSAPPOOLID461
    foreign key ("PR_ID")
    references DT461
    deferrable
    novalidate;
alter table SAPPOOL enable validate constraint FKSAPPOOLID461;

create index IDX_SAPPOOLID461 on SAPPOOL ("PR_ID");

alter table SAPPOOL MODIFY ("UUID" DEFAULT SYS_GUID());

alter table SAPPOOL
    add constraint DT964UUID_NOT_NULL check("UUID" is not null);

alter table SAPPOOL MODIFY ("CREATED_ON" DEFAULT TO_DATE('01.01.1970','DD.MM.YYYY'));

alter table SAPPOOL MODIFY ("MODIFIED_ON" DEFAULT TO_DATE('01.01.1970','DD.MM.YYYY'));

alter table SAPPOOL MODIFY ("RWDU" DEFAULT 0);

alter table SAPPOOL MODIFY ("OWNER_DI" DEFAULT 0);

alter table SAPPOOL MODIFY ("GROUP_DI" DEFAULT 0);

alter table SAPPOOL MODIFY ("ANY_DI" DEFAULT 0);

alter table SAPPOOL MODIFY ("COST_PLAN" DEFAULT 0);

alter table SAPPOOL MODIFY ("COST_ACT" DEFAULT 0);

alter table SAPPOOL MODIFY ("COST_REM" DEFAULT 0);

alter table SAPPOOL MODIFY ("EFFORT_PLAN" DEFAULT 0);

alter table SAPPOOL MODIFY ("EFFORT_ACT" DEFAULT 0);

alter table SAPPOOL MODIFY ("EFFORT_REM" DEFAULT 0);

alter table SAPPOOL MODIFY ("STATUS" DEFAULT 0);


