Search code examples
c#sqloracleplsqlora-01843

got ORA-01843 when I try to insert date & time to Oracle


I have A anb B in String format

A = 14/01/2007

B = 22:10:39

I try to insert date and time:

SQL = "insert into MyTbl(Tdate,Ttime) value ('" + Convert.ToDateTime(A) + "','" + Convert.ToDateTime(B) + "')";

i got ORA-01843 error, what I can do ?

thank's in advance


Solution

  • The error is due to the month, try:

    TO_DATE(A, 'DD/MM/YYYY')