UNIQUE and NULL in SQL
From: Brian Smith <brian-l-smith_at_uiowa.edu>
Date: 29 Dec 2001 19:28:12 -0800
Message-ID: <60360d48.0112291928.2e7c5818_at_posting.google.com>
What is the rationale for having a UNIQUE constraint treat NULLS as equal?
Date: 29 Dec 2001 19:28:12 -0800
Message-ID: <60360d48.0112291928.2e7c5818_at_posting.google.com>
What is the rationale for having a UNIQUE constraint treat NULLS as equal?
How can I create a UNIQUE constraint on a column that allows multiple rows to have NULL for that column:
CREATE TABLE x ( x NUMBER UNIQUE);
INSERT INTO x VALUES (1); -- SUCCEESS INSERT INTO x VALUES (1); -- FAILURE INSERT INTO x VALUES (NULL); -- SUCCESS INSERT INTO x VALUES (NULL); -- FAILURE
Thanks,
Brian
Received on Sun Dec 30 2001 - 04:28:12 CET