这是我在 Oracle 上进行日期查询时从 Django 获得的 SQL(我是 的一个实例Model.objects
):
from datetime import datetime as dt
dates = [dt(2014,07,01), dt(2014,07,02)]
print i.filter(incd_date_d__range=dates).query
SELECT "SCHEMA"."TABLE"."COL1", "SCHEMA"."TABLE"."DATE_COL"
FROM "SCHEMA"."TABLE"
WHERE "SCHEMA"."TABLE"."DATE_COL"
BETWEEN 2014-07-01 00:00:00 AND 2014-07-02 00:00:00
这将返回一个数据库错误 ( ORA-01850: hour must be between 0 and 23
)。请注意日期如何没有被引号括起来。这是预期的行为吗?