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.
今日、私はテーブルの1つに興味深い制約を見つけました。
alter table T1 add constraint C$T1_DUMMY check (null is null);
なぜこれが必要なのか、何か考えはありますか?
答えはとても簡単です。
条件null is nullは常にtrueを返します。したがって、CHECKステートメントは常にtrueを返し、したがって追加のビジネスロジックを強制しません。おそらくこれが、制約の名前が。である理由C$T1_DUMMYです。
null is null
CHECK
C$T1_DUMMY
empまた、Oracle独自のサンプルスキーマに含まれるテーブルで、自分のマシンで試してみました。完璧に動作します。構文エラーやその他の制約の強制を除いて、何も禁止されていません。
emp