|
In conclusion:
columname type not null result check (columnname is not null) is not the same
therefore:
1, no need to manually to match NULLABLE property, when all explicitly bound by the result NULLABLE Y variable N is deleted, NULLABLE will naturally return to the Y.
2, try not to use to achieve CHECK NOT NULL, you can use the MODIFY statement or directly in the field after
drop table zwxtest04;
create table zwxtest04
(
id integer
);
alter table zwxtest04 add constraint zwxtest04c2 check (id is not null);
select * from user_tab_columns where table_name = 'ZWXTEST04';
select * from user_constraints where table_name = 'ZWXTEST04';
--NULLABLE Is Y, constraint and does not lead to change NULLABLE
drop table zwxtest04;
create table zwxtest04
(
id integer not null
);
select * from user_tab_columns where table_name = 'ZWXTEST04';
select * from user_constraints where table_name = 'ZWXTEST04';
- NULLABLE is N, and automatically add a C-type NOT NULL constraints
drop table zwxtest04;
create table zwxtest04
(
id integer
);
alter table zwxtest04 id not nul;
select * from user_tab_columns where table_name = 'ZWXTEST04';
select * from user_constraints where table_name = 'ZWXTEST04';
- NULLABLE is N, and automatically add a C-type NOT NULL constraints
drop table zwxtest04;
create table zwxtest04
(
id integer
);
alter table zwxtest04 add constraint zwxtest04c3 primary key (id);
select * from user_tab_columns where table_name = 'ZWXTEST04';
select * from user_constraints where table_name = 'ZWXTEST04';
- NULLABLE as N, P-type constraints create, create UNIQUE index
alter table zwxtest04 drop constraint zwxtest04c3;
--NULLABLE To Y |
|
|
|