2014-06-20 793 views
1

我得到ORA-00920: invalid relational operator錯誤,當我跟隨contion到我的where子句。ORA-00920:無效的關係運算符在where子句中

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 
+2

你能後的全'WHERE'條款? –

+1

並且列的數據類型 –

+0

您是否需要將TO_DATE添加到a.time_stamp和a.rest_time字段? – rvphx

回答

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 ; 
+0

大聲笑我甚至發佈這個問題感覺不好。這是一個額外的括號,當我從我的另一個查詢複製這個條件。我可能錯過了複製'('。再次感謝。 – user206168

相關問題