我使用cx峎oracle python库来查找在过去90分钟内有modifiedDate的任何记录。在import cx_Oracle
import datetime
from datetime import timedelta
import config as config
timeNow = datetime.datetime.now()
previousTime = timeNow - datetime.timedelta (minutes = 0)
connection = cx_Oracle.connect(user, password, connection)
cur = connection.cursor()
statement = "SELECT * FROM woodburn_all WHERE modifiedDate >= to_date(" + str(previousTime) +")"
print statement
r = cur.execute(statement)
for row in cur:
print row
打印的select语句看起来正确:
SELECT * FROM woodburn_all WHERE to_date(modifiedDate) >= to_date(2018-09-2 11:02:10.460000)
我看不出我在哪里丢了什么括号。这是什么奇怪的日期/时间吗?在
编辑:使用pythonv2.7