筛选日期以显示Oracle SQL中的顺序

nbewdwxp  于 2023-04-29  发布在  Oracle
关注(0)|答案(1)|浏览(126)

我需要显示日期20141211到20141214的数据。但是有一个错误。

SELECT *
FROM ORDERS
WHERE ORDER_DATE >= '20141211'
  AND ORDER_DATE < '20141214'

但似乎不起作用

"ORA-01861: literal does not match format string
01861. 00000 -  "literal does not match format string"
*Cause:    Literals in the input must be the same length as literals in
           the format string (with the exception of leading whitespace).  If the
           "FX" modifier has been toggled on, the literal must match exactly,
           with no extra whitespace.
*Action:   Correct the format string to match the literal."

20141211到20141214之间数据的过滤器详细信息。

dly7yett

dly7yett1#

错误是抱怨日期文字。使用有效的Oracle文字,您的查询应该可以工作:

SELECT *
FROM ORDERS
WHERE ORDER_DATE BETWEEN date '2014-12-11' AND date '2014-12-14';

相关问题