INSERT INTO Agents VALUES (10041, 'Kai', 'Marcoux', '1996-12-03', '1970-12-12'); 使用如上语句插入时提示文字与格式字符串不匹配, INSERT INTO Agents VALUES (10235, 'Tobias', 'Carling', '19-Dec-00', '19-Oct-75'); 使用如上格式插入时提示无效的月份
使用to_date函数 ************to_date函数参数简介*********** http://hi.baidu.com/ubuntu110/blog/item/dc02862b8f8b5f93033bf69d.html ****************************************** 对于你的问题 '1996-12-03' 改为 to_date('1996-12-03','yyyy-mm-dd') '1970-12-12' 改为 to_date('1970-12-12','yyyy-mm-dd') '19-Dec-00' 改为 to_date('19-Dec-00','dd-mon-yy') '19-Oct-75' 改为 to_date('19-Oct-75','dd-mon-yy') 之后直接插入即可。 **************oracle上的实验************** SQL> select to_char(sysdate,'yyyy-mm-dd') from dual; TO_CHAR(SY ---------- 2009-04-17 SQL> select to_char(sysdate,'dd-mon-yy') from dual; TO_CHAR(S --------- 17-apr-09 ****************************************** ---- 转载自秀逗的小猫