Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql ORA-01722:无效数字#时间_Sql_Oracle_Time - Fatal编程技术网

Sql ORA-01722:无效数字#时间

Sql ORA-01722:无效数字#时间,sql,oracle,time,Sql,Oracle,Time,我正在Oracle中运行下面提到的查询,我得到了ORA-01722:invalid number#time select * from time_checker where to_char(time,'HH24:MI') not between to_char('01:00','HH24:MI') and to_char('02:30','HH24:MI'); to_char(n,fmt)使用格式fmt:,将n转换为VARCHAR2数据类型的值 也许您应该使用。查询的正确版

我正在Oracle中运行下面提到的查询,我得到了
ORA-01722:invalid number#time

  select *
  from time_checker
  where to_char(time,'HH24:MI')
    not between to_char('01:00','HH24:MI') and to_char('02:30','HH24:MI');
to_char(n,fmt)
使用格式
fmt
:,将n转换为VARCHAR2数据类型的值


也许您应该使用。

查询的正确版本是

select * from time_checker where time not between 
  to_date('01:00','HH24:MI') and to_date('02:30','HH24:MI');
这里
time
是您要检查的字段。因此,理想情况下,必须将参数“01:00”等转换为列
time
的数据类型

  select *
  from time_checker
  where to_char(time,'HH24:MI')
    not between to_char('01:00','HH24:MI') and to_char('02:30','HH24:MI');

如果
time
列的类型为
timestamp
,那么使用
来设置timestamp

@Mirwais Faizi什么类型有时间列?实际上,我不想通过select语句选择(01:00)和(2:30)之间的时间,但问题是(1:00)和(2:30)也没有选择。