Reputation: 501
I am trying to insert a row in my oracle table, but it is giving error 'Date format not recognized'. Details are as below. What is wrong in this?
create table "employee" (
"emp_id" VARCHAR2(100 BYTE),
"emp_name" VARCHAR2(100 BYTE),
"hired_date" Date,
CONSTRAINT "PK_employee" PRIMARY KEY ("emp_id")
);
Insert into employee values ( 'A1234', 'John Day', TO_DATE('07/20/2020 15:05:20', 'MM/DD/YYYY H24:MI:SS'));
Upvotes: 0
Views: 538
Reputation: 5165
Please change the format to MM/DD/YYYY HH24:MI:SS
Insert into "employee" values ( 'A1234', 'John Day', TO_DATE('07/20/2020 15:05:20', 'MM/DD/YYYY HH24:MI:SS'));
Below is the demo
https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=d4c0dda817bebcdd7c8d025c77cdc5c1
Upvotes: 1
Reputation: 718
You are missing one 'H' use 'HH24'
Insert into "employee" values ( 'A1234', 'John Day', TO_DATE('07/20/2020 15:05:20', 'MM/DD/YYYY HH24:MI:SS'));
Upvotes: 3