Oracle query time field and sort

<if test="timestart!=null and timestart!=''">
<![CDATA[   and a.CREATDATE >=  TO_DATE(#{timestart}, 'yyyy-MM-dd hh24:mi:ss')   ]]>
</if>
<if test="timeend!=null and timeend!=''">
<![CDATA[  and a.CREATDATE <= TO_DATE(#{timeend}, 'yyyy-MM-dd hh24:mi:ss')    ]]>

</if>

order by TO_DATE(${sort}, 'yyyy.MM.dd')

The time range is set between #{timestart} and #{timeend}, use to_date to convert ${sort}, and convert the string time into a format that Oracle can recognize.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326030000&siteId=291194637