/* Выборки данных оборудования */
create table UDO_T_EQUIPDS
(
  /* Регистрационный номер */
  RN                        number(17) not null,
  /* Организация */
  COMPANY                   number(17) not null,
  /* Мнемокод */
  CODE                      varchar2(40) not null,
  /* Наименование */
  NAME                      varchar2(200) not null,
  /* Ключи */
  constraint UDO_C_EQUIPDS_RN_PK primary key (RN),
  constraint UDO_C_EQUIPDS_COMPANY_FK foreign key (COMPANY) references COMPANIES(RN),
  constraint UDO_C_EQUIPDS_CODE_NB check (rtrim(CODE) is not null),
  constraint UDO_C_EQUIPDS_NAME_NB check (rtrim(NAME) is not null),
  constraint UDO_C_EQUIPDS_CODE_UN unique (COMPANY, CODE),
  constraint UDO_C_EQUIPDS_NAME_UN unique (COMPANY, NAME)  
);
