In the oracle database, check the data of a certain time period between a period of time

SELECT  CREATE_DATE FROM
WORK_ORDER
WHERE  CREATE_DATE between
to_date('2021-12-10 10:53:44','yyyy-MM-dd hh24:mi:ss') 
and to_date('2021-12-12 10:53:44','yyyy-MM-dd hh24:mi:ss')

The results show

 Note:
       When using Oracle's to_date function to do date conversion, you may intuitively use the format "yyyy-MM-dd HH:mm:ss" as the format for conversion, but it will cause an error in Oracle: "ORA 01810 format The code appears twice". The reason is that SQL is case-insensitive, and MM and mm are considered to be the same format code, so Oracle's SQL uses mi instead of minutes.

Guess you like

Origin blog.csdn.net/weixin_55823910/article/details/124104061