ora - 00936:失踪的表达式。在oracle apex中向子类型添加约束

时间:2021-08-17 22:31:16

alter table "PHYSICIAN" add constraint "PHYSICIAN_CON" check ( "STAFF_NO" IN Select STAFF_NO From STAFF Where POSITION='PHYSICIAN') /

改变表“医生”添加约束“医生”检查(“STAFF_NO”在选择STAFF_NO时,从POSITION=' doctor ') /

1 个解决方案

#1


2  

You cannot have a subquery within a CHECK constraint. It's simply not supported by Oracle.

在检查约束中不能有子查询。它根本不受Oracle的支持。

From the Oracle documentation:

从甲骨文文档:

Conditions of check constraints cannot contain the following constructs:

检查约束条件不能包含以下结构:

  • Subqueries and scalar subquery expressions
  • 子查询和标量子查询表达式。

I'm afraid that there's no constraint you can use to enforce your condition, unless you have a table somewhere that contains only the physicians. However, I suspect that if you did have such a table, you'd probably have already figured out it would be a better idea to create a FK constraint to that table instead.

恐怕你没有任何约束可以用来加强你的病情,除非你有一个桌子,里面只有医生。然而,我怀疑,如果您确实有这样一个表,您可能已经发现,为该表创建一个FK约束将是一个更好的主意。

#1


2  

You cannot have a subquery within a CHECK constraint. It's simply not supported by Oracle.

在检查约束中不能有子查询。它根本不受Oracle的支持。

From the Oracle documentation:

从甲骨文文档:

Conditions of check constraints cannot contain the following constructs:

检查约束条件不能包含以下结构:

  • Subqueries and scalar subquery expressions
  • 子查询和标量子查询表达式。

I'm afraid that there's no constraint you can use to enforce your condition, unless you have a table somewhere that contains only the physicians. However, I suspect that if you did have such a table, you'd probably have already figured out it would be a better idea to create a FK constraint to that table instead.

恐怕你没有任何约束可以用来加强你的病情,除非你有一个桌子,里面只有医生。然而,我怀疑,如果您确实有这样一个表,您可能已经发现,为该表创建一个FK约束将是一个更好的主意。