TCF-Framework-Integration/db/UDO_T_EQUIPDSCMML.sql

35 lines
2.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* Выборки данных оборудования (классы оборудования, модели) */
create table UDO_T_EQUIPDSCMML
(
/* Регистрационный номер */
RN number(17) not null,
/* Родитель */
PRN number(17) not null,
/* Задача (TCF - оценка технического состояния (Technical Condition Forecast), RUL - прогнозирование остаточного ресурса (Remaining Useful Life), FP - Прогнозирование отказа (Failure Predict)) */
TASK varchar2(3) default 'RUL' not null,
/* Точность (план) */
PRECISION_P number(3) not null,
/* Точность (факт) */
PRECISION_F number(3) default null,
/* Идентификатор очереди обработки */
QUEUE_ID varchar2(200) default null,
/* Состояние */
STATUS number(1) default 0 not null,
/* Сообщение об ошибке */
ERR varchar2(4000) default null,
/* Ключи */
constraint UDO_C_EQUIPDSCMML_RN_PK primary key (RN),
constraint UDO_C_EQUIPDSCMML_PRN_FK foreign key (PRN) references UDO_T_EQUIPDSCM(RN),
constraint UDO_C_EQUIPDSCMML_TASK_NB check (rtrim(TASK) is not null),
constraint UDO_C_EQUIPDSCMML_TASK_CH check (TASK in ('TCF', 'RUL', 'FP')),
constraint UDO_C_EQUIPDSCMML_PRECP_CH check ((PRECISION_P > 0) and (PRECISION_P <= 100)),
constraint UDO_C_EQUIPDSCMML_PRECF_CH check ((PRECISION_F is null) or ((PRECISION_F is not null) and (PRECISION_F > 0) and (PRECISION_F <= 100))),
constraint UDO_C_EQUIPDSCMML_QID_NB check ((QUEUE_ID is null) or (rtrim(QUEUE_ID) is not null)),
constraint UDO_C_EQUIPDSCMML_QID_CH check (((STATUS in (1, 2, 3)) and (QUEUE_ID is not null)) or (STATUS not in (1, 2, 3))),
constraint UDO_C_EQUIPDSCMML_STATUS_CH check (STATUS in (0, 1, 2, 3)),
constraint UDO_C_EQUIPDSCMML_ERR_NB check ((ERR is null) or (rtrim(ERR) is not null)),
constraint UDO_C_EQUIPDSCMML_ERR_CH check (((STATUS in (3)) and (ERR is not null)) or (STATUS not in (3))),
constraint UDO_C_EQUIPDSCMML_UN unique (PRN, TASK, PRECISION_P, QUEUE_ID),
constraint UDO_C_EQUIPDSCMML_QID_UN unique (QUEUE_ID)
);