Sql ORA-00920:where子句中的关系运算符无效
当我遵循where子句的contion时,我得到了ORA-00920:invalid relational operator错误Sql ORA-00920:where子句中的关系运算符无效,sql,oracle,Sql,Oracle,当我遵循where子句的contion时,我得到了ORA-00920:invalid relational operator错误 and (round(to_number(c.rest_time - a.TIME_STAMP) * 24 * 60 )) > 5 完整Where子句 From TableA a,TableB b where round(to_number(a.rest_time - a.time_stamp) * 24 * 60 )) > 5 an
and (round(to_number(c.rest_time - a.TIME_STAMP) * 24 * 60 )) > 5
完整Where子句
From TableA a,TableB b
where round(to_number(a.rest_time - a.time_stamp) * 24 * 60 )) > 5
and a.time_stamp > '05-12-2014 22:00:00'
and a.rest_time < '05-14-2014 14:00:00'
and a.dev = 'CUSTOMER'
and b.xid = a.xid
and b.accno = a.accno
and b.name is not null
and b.dis is null
来自表a、表b
其中四舍五入(到数字(a.休息时间-a.时间戳)*24*60))>5
时间戳>'05-12-2014 22:00:00'
和a.休息时间<'05-14-2014 14:00:00'
和a.dev='CUSTOMER'
b.xid=a.xid
b.accno=a.accno
并且b.name不为空
而b.dis是空的
您有额外的右括号。它应该是。。。其中四舍五入(到数字(a.休息时间-a.时间戳)*24*60)>5…
比如说,
-- your case (throws invalid relational operator ):
select 1 from dual where round(to_number(sysdate- sysdate) * 24 * 60 )) > 5 ;
--corrected :
select 1 from dual where round(to_number(sysdate- sysdate) * 24 * 60 ) > 5 ;
你能发布完整的
WHERE
子句吗?以及你需要添加到a.time\u标记和a.rest\u时间字段的列的数据类型吗?事情是相同的,我在不同但相似的查询中有相同的条件,它不会抛出错误。..a.time\u标记>'05-12-2014 22:00:00'将数字与字符串进行比较不是吗?哈哈,我感觉很糟糕甚至张贴这个问题。当我从另一个查询复制这个条件时,它是一个额外的括号。我可能没抄到(
),再次感谢。