title: ORA-00920: invalid relational operator while using case
body: <p>I am writing a code using oracle developer to find if there is a login from a device for 3 consecutive days, I'm writing a code using case function but it is giving me invalid relational operator error. I don't know where I am wrong.</p>
  
  <p>thanks in advance</p>
  
  <pre><code>SELECT *FROM
  (SELECT a.*,substr(TEXT_USERNAME,2,length(TEXT_USERNAME)-2), row_number() 
  over (partition by trunc(DTIME_LOGIN) order by TEXT_USERNAME ) rn
  
   FROM 
    OWNER_DWH.F_HOSEL_USER_LOGIN_TT a)
  
   WHERE
  
    (CASE WHEN trunc(dtime_login)=trunc(sysdate-1) then  'y'
    ELSE 'n' END ) D1
    and 
     (CASE WHEN trunc(dtime_login)=trunc(sysdate-2) then  'y'
    ELSE 'n' END) D2
    and 
     (CASE WHEN trunc(dtime_login)=trunc(sysdate-3) then  'y'
    ELSE 'n' END) D3
  </code></pre>