将时间戳插入Oracle数据库(Inserting timestamp into Oracle database)
我正在尝试将一些时间戳插入Oracle数据库表但获取ORA-01843: not a valid month错误。 字符串的格式是如何拉取数据,所以如果有任何问题,我必须在拉取数据后纠正它。
INSERT INTO SCHEMA.TABLE_NAME (START_TIME, END_TIME ) VALUES ( TO_TIMESTAMP('2016-12-19 13:30:00, YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2016-12-19 14:33:00, YYYY-MM-DD HH24:MI:SS') );I'm trying to insert some timestamps into an Oracle DB table but getting an ORA-01843: not a valid month error. The format of the string is how the data is pulled so if there's any issue with that, I'll have to correct that after the data is pulled.
INSERT INTO SCHEMA.TABLE_NAME (START_TIME, END_TIME ) VALUES ( TO_TIMESTAMP('2016-12-19 13:30:00, YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2016-12-19 14:33:00, YYYY-MM-DD HH24:MI:SS') );最满意答案
您错过了在日期之后关闭单引号并在格式掩码之前开始:
INSERT INTO SCHEMA.TABLE_NAME (START_TIME, END_TIME ) VALUES ( TO_TIMESTAMP('2016-12-19 13:30:00', 'YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2016-12-19 14:33:00', 'YYYY-MM-DD HH24:MI:SS') );You missed to close the single quote after the date and start before the format mask:
INSERT INTO SCHEMA.TABLE_NAME (START_TIME, END_TIME ) VALUES ( TO_TIMESTAMP('2016-12-19 13:30:00', 'YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2016-12-19 14:33:00', 'YYYY-MM-DD HH24:MI:SS') );更多推荐
发布评论