Any suggestions on whether less verification restrictions are better or more? How should they be grouped, if at all?
Suppose I have 3 columns which VARCHAR2(1 BYTE), each of which is the flag 'T' / 'F'. I want to add a validation constraint to each column, indicating that only characters are allowed IN ('T', 'F').
Should I have 3 separate control constraints, one for each column:
COL_1 IN ('T', 'F')
COL_2 IN ('T', 'F')
COL_3 IN ('T', 'F')
Or one check constraint:
COL_1 IN ('T', 'F') AND COL_2 IN ('T', 'F') AND COL_3 IN ('T', 'F')
My thoughts are that it is best to keep these three separate from each other, since the columns are logically not connected to each other. The only case where I would have a validation constraint that validates more than one column is if there was some connection between the value in one and the value in the other, for example:
(PARENT_CNT > 0 AND PRIMARY_PARENT IS NOT NULL) OR (PARENT_CNT = 0 AND PRIMARY_PARENT IS NULL)
source
share