ORA-00920:where子句中的无效关系运算符

时间:2014-06-20 15:30:03

标签: sql oracle

当我跟随where子句的contion时,我得到ORA-00920: invalid relational operator错误。

and (round(to_number(c.rest_time - a.TIME_STAMP) * 24 * 60 )) >  5

Full 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 

1 个答案:

答案 0 :(得分:1)

你有额外的右括号。它应该是... where round(to_number(a.rest_time - a.time_stamp) * 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 ;