django中的Oracle日期查询

时间:2014-09-29 04:48:20

标签: python django oracle django-1.7

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

0 个答案:

没有答案