【发布时间】:2021-04-22 12:57:16
【问题描述】:
我创建了一个表 (test_table),它有两列 (test_IP, test_STATUS)。该表可以有任意数量的 IP,但是,只能允许一个状态为“活动”的 IP。可以允许任意数量的“非活动”状态。供参考(活跃 = 1,不活跃 = 2)
例如:
test_IP test_STATUS
==============================
1.2.3.4 1
1.2.3.5 2
1.2.3.6 2
1.2.3.7 2
1.2.3.8 1 -- this should now fail (as there are multiple values containing 1 (Active))
是否可以对特定值具有唯一约束?如果是这样,有人可以帮助我如何实现这一目标吗?提前致谢!
【问题讨论】:
标签: oracle constraints unique