这是我在对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
)。请注意日期不如何被引号括起来。这是预期的行为吗?