Oracle数据库:ORA-01861: 文字与格式字符串不匹配
1、报错背景:使用DBeaver向oracle数据库批量插入数据INSERT ALL INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京','2000-01-01')INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京',
·
1、报错背景:使用DBeaver 向oracle数据库批量插入数据
INSERT ALL INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京','2000-01-01')
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京','2000-01-01')
SELECT 1 FROM dual
2、报如上错误 :ORA-01861: 文字与格式字符串不匹配
3、报错原因:由于birthday字段是DATE类型,所以,在插入操作时需要格式化类型
INSERT ALL INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','男','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
INTO Student(name,sex,age,address,birthday) VALUES('Nike','女','18','北京',TO_DATE(TO_CHAR('2000-01-01'),'yyyy-MM-dd'))
SELECT 1 FROM dual
4、如此,便可插入成功了
希望对大家会有所帮助,前路漫漫,一起探究.......................
更多推荐



所有评论(0)