福州网站建设>网站新闻>thinkphp6专区

tp6中oracle怎么通过日期查询,怎么处理todate()

发布日期:2022-03-12浏览次数:435 来源:福州网站建设 标签: tp6 oracle todate 日期

oracle的原生语句:select * from aa_table f
where
and f.fee_time >= to_date('2022-1-22', 'yyyy-mm-dd')
and f.fee_time < to_date('2022-1-22', 'yyyy-mm-dd') + 1;

如果用tp6的写法,加上日期就会查出报错,取消日期就可查,试了几个办法都不行。

$rz=Db::table('aa_table')->where([
['fee_time','>', "to_date('2022-1-22', 'yyyy-mm-dd')"],
['fee_time','>', "to_date('2022-1-23', 'yyyy-mm-dd')"]
])->select();
报错如下:
SQLSTATE[HY000]: General error: 1858 OCIStmtExecute: ORA-01858: a non-numeric character was found where a numeric was expected
(/usr/local/src/php-7.2.21/ext/pdo_oci/oci_statement.c:159

请教一下,这个日期,todate()应该怎么处理。怎么加上日期来查询。

以上是由福州网站建设的小编为你分享了"tp6中oracle怎么通过日期查询,怎么处理todate()"文章,如果你在这方面有什么问题,随时联系我们

网友评论

  • ぺ灬紫夜 03月24日

    whereExp('CREATE_TIME',">TO_DATE('2021-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')")

  • yzh52521 03月11日

    whereRaw('fee_time > to_date('2022-1-22', 'yyyy-mm-dd'))

thinkphp6专区有关的文章
与标签 tp6 oracle todate 日期 有关的文章
如果您有什么问题,欢迎咨询我们客服! 点击QQ咨询