时间:2021-07-01 10:21:17 帮助过:25人阅读
CREATE TABLE AAA_Huch
(
StudentID varchar2(50) primary key,
StudentName varchar2(50) default ‘‘ not null
);
SELECT * FROM AAA_HUCH;
--由于StudentName是not null,插入的时候不能赋null,否则会报错
INSERT INTO AAA_Huch(StudentID)
VALUES(‘AA‘);
--也不能这样
INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES(‘AA‘,NULL);
--这样也会报错,oracle中‘‘会当成null处理
INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES(‘bb‘,‘‘);
--只能这样,插入一个空格符
INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES(‘bb‘,‘ ‘);
alter table aaa_huch
add sex int default 0;
INSERT INTO AAA_Huch(StudentID,StudentName)
VALUES(‘cc‘,‘cc‘);
select * from alarm_info;
oracle默认值not null,插入的时候不能赋null,否则会报错
标签:primary varchar2 报错 处理 ble name value obd def