WeVie
WeVie

Reputation: 598

Inserting timestamp into Oracle database

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')
);

Upvotes: 0

Views: 2479

Answers (1)

Gurwinder Singh
Gurwinder Singh

Reputation: 39457

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')
);

Upvotes: 1

Related Questions