oracle默認值not null,插入的時候不能賦null,不然會報錯

SELECT * FROM OBD_DATA;oracle

CREATE TABLE AAA_Huch
(
StudentID varchar2(50) primary key,
StudentName varchar2(50) default '' not null
);ide

SELECT * FROM AAA_HUCH;it

--因爲StudentName是not null,插入的時候不能賦null,不然會報錯
INSERT INTO AAA_Huch(StudentID)
VALUES('AA');table

--也不能這樣
INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES('AA',NULL);class

--這樣也會報錯,oracle中''會當成null處理
INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES('bb','');select

--只能這樣,插入一個空格符
INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES('bb',' ');im

alter table aaa_huch
add sex int default 0;tab

INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES('cc','cc');di

select * from alarm_info;view