ORA-01861: literal does not match format string

后端 未结 4 1382
南方客
南方客 2020-12-06 03:58

When I try to execute this snippet:

cmd.CommandText = \"SELECT alarm_id,definition_description,element_id,
    TO_CHAR (alarm_datetime, \'YYYY-MM-DD HH24:MI:         


        
4条回答
  •  抹茶落季
    2020-12-06 04:22

    Remove the TO_DATE in the WHERE clause

    TO_DATE (alarm_datetime,'DD.MM.YYYY HH24:MI:SS')
    

    and change the code to

    alarm_datetime
    

    The error comes from to_date conversion of a date column.

    Added Explanation: Oracle converts your alarm_datetime into a string using its nls depended date format. After this it calls to_date with your provided date mask. This throws the exception.

提交回复
热议问题