我是这样的Oracle查询:
SELECT * FROM
WHERE
CODE='AMB01'
AND MyHour BETWEEN
TO_DATE('11/01/2018 16:00:00', 'DD/MM/YYYY hh24:mi:ss') AND
TO_DATE('11/01/2018 16:30:00', 'DD/MM/YYYY hh24:mi:ss')
它返回错误:
Month not valid
Myhour是一个String字段。
错误是什么?
由于
答案 0 :(得分:1)
编辑: 你需要转换MyHour,而不是部分转换。
SELECT * FROM
WHERE
CODE='AMB01'
AND TO_DATE(MyHour, 'DD/MM/YYYY hh24:mi:ss') BETWEEN
'11-01-2018 16:00:00' AND
'11-01-2018 16:30:00'
答案 1 :(得分:0)
如果MyHour
类型不同,请将列类型设置为Date
UPDATE_DATETIME DATE
SELECT * FROM YourTable
WHERE MyHour BETWEEN
TO_DATE('11/01/2018 16:00:00', 'DD/MM/YYYY hh24:mi:ss') AND
TO_DATE('11/01/2018 16:30:00', 'DD/MM/YYYY hh24:mi:ss')