PRIMARY KEY and NOT NULL
I've seen this far too often. A table with a primary key (good) and a check constraint (NOT NULL) on the same column.
Stop doing it. Watch.
CREATE TABLE t
(
id NUMBER
CONSTRAINT pk_id PRIMARY KEY
);
SH@I_HAVE_NO_IDEA>INSERT INTO t ( id ) VALUES ( 1 );
1 row created.
Elapsed: 00:00:00.33
SH@I_HAVE_NO_IDEA>INSERT INTO t ( id ) VALUES ( NULL );
INSERT INTO t ( id ) VALUES ( NULL )
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SH"."T"."ID")
As
HillbillyToad said,

It is better than no constraint, that's for sure. The heart was in the right place...
Labels: constraints, development, oradb, sql, wtf