0

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')
);
2
  • 2
    missing quotes around timestamp. these are 2 different arguments. use TO_TIMESTAMP('2016-12-19 13:30:00', 'YYYY-MM-DD HH24:MI:SS') Commented Dec 27, 2016 at 14:20
  • You are calling functions to convert strings to timestamps. You could simply use timestamp literals instead: VALUES ( timestamp '2016-12-19 13:30:00', timestamp '2016-12-19 14:33:00' );. Commented Dec 27, 2016 at 17:47

1 Answer 1

1

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')
);
Sign up to request clarification or add additional context in comments.

1 Comment

wow I've looked at this for 20 minutes or more. Thanks for pointing out my boneheadednesss. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.