Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

format code appears twice error while inserting DATETIME from C# to Oracle DB

I am facing the below oracle error for the query

Insert Query:

INSERT INTO WINBACK_REFERRAL_CODES
  (REFERRAL_CODE, IS_DELETED,  CREATED_BY, 
   CREATED_DT,
   MODIFIED_BY,
   MODIFIED_DT, DELETED_BY,  DELETED_DT)
values
  ('sfsdfsd',     'N',         'LA\a03789',
   To_date('4/18/2013 3:57:47 PM','MM/DD/YYYY HH12:MI:SS AM'),
   '',
   To_date('','MM/DD/YYYY HH12:MI:SS AM'),
   '',
   To_date('4/18/2013 3:57:47 PM','MM/DD/YYYY HH12:MM:SS AM'));

ERROR MESSAGE:

Can someone please help me resolving this issue. I am trying to insert date and time in this format 4/18/2013 3:57:47 PM to oracle DB.

like image 455
user545359 Avatar asked Dec 05 '22 11:12

user545359


1 Answers

To_date('4/18/2013 3:57:47 PM','MM/DD/YYYY HH12:MM:SS AM') should be rewritten to To_date('4/18/2013 3:57:47 PM','MM/DD/YYYY HH12:MI:SS AM'). Note the change from MM to MI.

like image 152
aquaraga Avatar answered Mar 08 '23 23:03

aquaraga