Mike3355
Mike3355

Reputation: 12081

ORA-01843: not a valid month when executing insert statement

I have the query which is inserting a date with the format year month day, but I keep getting a same error saying ORA-01843: not a valid month. Looking the oracle docs it appears I am correct which is confusing. Hoping to get an extra set of eyes.

  to_timestamp('2018-07-02 08:03:24.466381 AM', 'RR-MON-DD HH.MI.SSXFF AM')

and

to_timestamp('2115-07-21 00:00:00.0 AM', 'RR-MON-DD HH.MI.SSXFF AM')

Upvotes: 1

Views: 190

Answers (1)

user330315
user330315

Reputation:

MON is the format mask for the name of the month. As you are supplying the number, you need MM

to_timestamp('2018-07-02 08:03:24.466381 AM', 'yyyy-MM-dd hh.mi.ssxff am')

And as you are supplying a four-digit year yyyy is probably a better choice than rr

Upvotes: 6

Related Questions