Sql ORA-01722:无效数字#时间
我正在Oracle中运行下面提到的查询,我得到了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数据类型的值 也许您应该使用。查询的正确版
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)也没有选择。