title: Comparison between day of week in oracle
body: <p>I have problems with comparing the day of week</p>
  
  <p>Here is my query in oracle database.</p>
  
  <pre><code>  SELECT DAY, WEEKDAY
      FROM (SELECT v.TNI, v.FRMP, v.LR, v.DAY, v.HH, v.VOLUME,
      CASE WHEN hd.HOLIDAY_DATE is not null then 'HOLIDAY'
      ELSE to_char(v.DAY, 'Day') END AS WEEKDAY
      FROM v_nem_rm16 v
      LEFT JOIN DBP_ADMIN.DBP_HOLIDAY hd 
      ON v.DAY = hd.HOLIDAY_DATE
      WHERE v.STATEMENT_TYPE != 'FORECAST')
    WHERE WEEKDAY = 'Monday';
  </code></pre>
  
  <p>Basically, the "WEEKDAY" column has the day of week based on the "DAY". Day is just date like 13/Mar/17<br><br>
  If you look at the "CASE" statement, you will notice that the "WEEKDAY" column is filled by "to_char(v.DAY, 'Day')". <br>
  So the column has values like "Sunday, Saturday and so on, the day of week".
  <br>
  <br>
  The problem is the outer query's where clause, "WHERE WEEKDAY = 'Monday'"<br>
  When I execute this query, It does not give me any rows even if I have rows having Monday as the value in "WEEKDAY" column</p>
  
  <p><br><br>
  But when I change the WHERE clause to "WHERE WEEKDAY = to_char(sysdate, 'Day')", It works fine. The sql statement gives me the rows having "Saturday" in "WEEKDAY" column since the "to_char(sysdate, 'Day')" gives me "Saturday".</p>
  
  <p>So what is problems with my first query??</p>
  
  <p>I just want to filter rows by the name of the day of week like if i pass "Monday", i want to have all the rows having " Monday" in "WEEKDAY" column.</p>
  
  <p>How can I do??</p>
  
  <p>THANKS GUYS</p>