Part II here.
OK, we have a winner. Coskan Gundogar suggested in the comments, that using the MODIFY clause of the ALTER TABLE statement should work. Let's see:
desc t_nullVoila!
Name Null? Type
----------------------- -------- ----------------
COL1 VARCHAR2(30)
CJUSTICE@TESTING>ALTER TABLE T_NULL DROP CONSTRAINT nn_col1_tn;
Table altered.
CJUSTICE@TESTING>ALTER TABLE t_null MODIFY ( col1 CONSTRAINT nn_col1_tn NOT NULL );
Table altered.
CJUSTICE@TESTING>@DESC T_NULL
Name Null? Type
----------------------- -------- ----------------
COL1 NOT NULL VARCHAR2(30)
Much better. The question still remains as to what's going on in the background. Until now, I had never thought that white space mattered in anything Oracle. Very strange.
Maybe I can get Miladin to dig through the internals and see what's really going on.
@chet @oraclenerd
ReplyDeleteYou may want to check the value of SYS.COL$.NULL$ when adding the NOT NULL constraint versus a CHECK constraint checking for NULL.
My guess is that when you use the NOT NULL, it gets set to 0 (or maybe it is 1). Adding a check constraint , i doubt Oracle is checking this condition and setting the flag.