oracle默认值not null,插入的时候不能赋null,否则会报错
2020-08-12 22:30
1736 查看
SELECT * FROM OBD_DATA;
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;
相关文章推荐
- MySQL入门--插入记录的时候NULL与NOT NULL
- Db2数据库中错误提示:23502,不能把null 直插入到定义为not null 的列中
- 创建SQL作业错误的解决方法(不能将值 NULL 插入列 'owner_sid',表 'msdb.dbo.sysjobs';列不允许有空值。)
- oracle 用一条SQL判断插入数据的时候是否重复
- hibernate执行插入时候报错SQLServerException: 当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'T_WY_KFUSER' 中的标识列插入显式值
- com.microsoft.sqlserver.jdbc.SQLServerException: 不能将值 NULL 插入列 'ID'
- Oracle not in子连接查询不到值的问题(not in 不能查询null数据)
- 向Oracle插入为null的字符串,提示“缺失标识符
- 怎么在插入oracle记录的时候同时得到自动增长的ID值(未解决)
- Oracle中Clob类型处理解析(NHibernate long值绑定long列,或者是直接oraclecommand的插入的时候报错都能用,ORA-01461:仅可以插入LONG列的LONG值赋值
- sqlserver: 不能将值 NULL 插入列 'id'
- oracle 对象上锁,不能插入或删除情况
- ConstraintLayout fragment activity 嵌套的时候,ConstraintLayout 不能作为activity的根节点,否则fragment显示不出来
- 模板类的定义和实现不能分开,只能写在.h中,否则链接的时候会报错
- MySQL timestamp NOT NULL插入NULL的问题
- 向Oracle插入为null的字符串,提示“缺失标识符
- 不能将值 NULL 插入列 'id',表 'weibo.dbo.myfriend';列不允许有空值。INSERT 失败。
- oracle 里 插入空字符串会被转成null插入
- Oracle 语法 存在则更新否则插入新数据
- 转----Oracle中Clob类型处理解析(NHibernate long值绑定long列,或者是直接oraclecommand的插入的时候报错都可以用,ORA-01461:仅可以插入LONG列的LONG值赋值)