sql - Oracle. Constrain one row to have a certain value -


I want to add an obstacle to a table where in one column there is only one row at the same time with the value May be.

For example create a table of MyTable .... position varchar (1); )

A check on the Status column will be 'O', 'C', 'P' for open, closed or pending.

Multiple shutdowns and pending can be open but only one row (or none) in the table can be open.

Any indication appreciated.

Create a unique function index:

  Unique index Mayandex and MyTable Create on (case status when 'o' then 'he' end);  

This prevents the value from entering two 'O' values, but will allow other duplicate values.


Comments

Popular posts from this blog

python - rpy2 import is not working -

c++ - How to load a bitmap from file into the samples buffer -

javascript - How to get MySQL query result returned using $.ajax -