Oracle 10g: Suppose the following table (T_REGISTER):
ID_PROCESS PERIOD CUSTOMER STATUS
===========================================
0001234 201801 12300344 INVALID
0001236 201801 12300344 INVALID
0001246 201801 12300344 UNPAID
0001249 201801 12300344 UNPAID
0001278 201801 12300344 COMPLETED
ID_PROCESS is the PK. But I also need that (PERIOD + CUSTOMER + STATUS) to be unique just when the STATUS is COMPLETED.
In other words, for one UNIQUE (PERIOD + CUSTOMER), I don't care having several INVALID or UNPAID rows, but I only can admit one unique (PERIOD;CUSTOMER; STATUS="COMPLETED")
Any elegant solution using CHECK CONSTRAINT before going for the trigger solution? Thanks in advance...