oracle:SQL时间段

时间:2023-12-25 23:59:37

oracle:

SQL时间段

CREATEDATE between to_date('" + startDate + " 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('" + endDate + " 23:59:59','yyyy-mm-dd hh24:mi:ss') - 一天或多天零点到零点

换个写法

if (!string.IsNullOrEmpty(dtStart))
{
queryStatement += " and CREATEDATE >= to_date('" + dtStart + " 00:00:00' ,'yyyy-mm-dd hh24:mi:ss')";
}
if (!string.IsNullOrEmpty(dtEnd))
{
queryStatement += " and CREATEDATE <= to_date('" + dtEnd + " 23:59:59' ,'yyyy-mm-dd hh24:mi:ss')";
}