select to_char(to_date(t.create_time,'yyyy-mm-dd hh24'),'yyyy-mm-dd') as create_time, t.equipment,t.remark,t.value from (
select t.create_time ,t.equipment,t.remark,sum(t.value) as value from (
select distinct to_char(t.create_time-12/24,'yyyy-mm-dd hh24') as create_time ,t.equipment,substr(t.remark,3,8) as remark,t.value from T_RFL1_DATA t) t
group by t.create_time,t.equipment,t.remark )t
where to_char(to_date(t.create_time,'yyyy-mm-dd hh24'),'yyyy-mm-dd') = '2022-01-07'
and to_char(to_date(t.create_time,'yyyy-mm-dd hh24'),'yyyy-mm-dd') < trunc(to_char(to_date('2022-01-07','yyyy-mm-dd hh24'),'yyyy-mm-dd')) + 12 / 24
大家帮我看看 Oracle 查询时报无效号码是怎么回事
有没有建表语句?没有建表语句不好测。
现在oracle官网上也有线上oracle测试服务器。可以直接输sql建表。写测试语句。
麻烦报错信息截个图,从来没有听说过有"无效号码"这个报错,接近一点的只有"无效数字"
如果是无效数字,常见于格式转换中格式不匹配的问题,你首先得说明一下T_RFL1_DATA.create_time的字段类型是什么,如果是varchar2类型,请把文本格式贴出来。
而且你这sql,本来就是字符串了,干嘛搞这么多转成date又转回去,这字符串本身直接就可以做查询条件呀,还有你最后的trunc是在干什么这是trunc了个寂寞,这玩意出来是个字符串,你在后面加个数字?这里肯定会报错呀