TCF-Framework-Integration/db/UDO_T_EQUIPDSCMML.sql

37 lines
2.7 KiB
SQL
Raw Permalink 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 number(17,2) default null,
/* Идентификатор очереди обработки */
QUEUE_ID varchar2(200) default null,
/* Состояние (0 - зарегистрирована, 1 - обрабатывается внешней системой, 2 - успешно обработана внешней системой, 3 - при обработке внешней системой произошла ошибка) */
STATUS number(1) default 0 not null,
/* Сообщение об ошибке */
ERR varchar2(4000) default null,
/* Идентификатор данных */
DATASET_ID number(17) not null,
/* Процедура формирования данных для прогнозирования */
USERPROCS_FRCST_DATA number(17) not 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_PREC_CH check ((PRECISION is null) or ((PRECISION is not null) and (PRECISION >= 0))),
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)) and (QUEUE_ID is not null)) or ((STATUS not in (1, 2)) and (QUEUE_ID is null))),
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)) and (ERR is null))),
constraint UDO_C_EQUIPDSCMML_USRPFD_FK foreign key (USERPROCS_FRCST_DATA) references USERPROCS(RN),
constraint UDO_C_EQUIPDSCMML_UN unique (PRN, TASK),
constraint UDO_C_EQUIPDSCMML_QID_UN unique (QUEUE_ID)
);