Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含 7 列(f_name、l_name、sex、birth_date、matri_num、dept、sal)的表,我想添加一个约束来验证 3 列(f_name、l_name、birth_date)中至少有 2 个已填充.
ALTER TABLE <your_table> ADD CONSTRAINT TWO_FILLED CHECK(NVL2(F_NAME, 1, 0) + NVL2(L_NAME, 1, 0) + NVL2(BIRTH_DATE, 1, 0) >= 2);