title: ORA-01861: literal does not match format string despite of using to_date function
body: <p>Facing this error on EXCEL VBA Module. On Oracle 11g interface it runs well.</p>
  
  <pre><code>select 
          "schema_name", "table_name", "bundle_name", "text_file", "sequence_no", 
                      lastupdateapplied, "next_sat_date","prev_sat_date", TO_DATE(SYSDATE,'DD-MM-YYYY'),
          CASE 
                  WHEN ("schema_name"='EDM_V1' OR "schema_name"='FF_V3' OR "schema_name"='SYM_V1') and 
                              ("next_sat_date"-lastupdateapplied&lt;=0 OR 
                              lastupdateapplied-"prev_sat_date"&gt;=0) 
                  then 'EVERYTHING LOOKS OK HERE.'
                  WHEN  ("schema_name"='FP_V2' OR "schema_name"='FE_V4' OR "schema_name"='REF_V2') and 
                              (lastupdateapplied - TO_DATE(SYSDATE,'DD-MM-YYYY') =0)
                  then 'EVERYTHING LOOKS OK HERE.'
                  Else 'PLEASE CHECK THE SCHEDULER FOR THIS FEED.' END as    "VERIFICATION_NOTE"
  from
          ( 
              select 
                      UPPER(ds."schema_name") as "schema_name", UPPER(ds."table_name") as "table_name", ds."bundle" as "bundle_name", ds."text_file" as "text_file", 
                      ds."sequence" as "sequence_no", TO_DATE(s2.end_time,'DD-MM-YYYY') as lastupdateapplied, TO_DATE(next_day(SYSDATE,'SATURDAY'),'DD-MM-YYYY') as "next_sat_date",  
                      TO_DATE(next_day(SYSDATE,'SATURDAY')-(INTERVAL '7' DAY + INTERVAL '1' SECOND),'DD-MM-YYYY') AS "prev_sat_date"
              from FDS_FDS_DATA_SEQUENCES ds 
              Join 
              (   select "table_name", "bundle", "text_file", max("end_time") as end_time 
                  from FDS_FDS_FILE_HISTORY 
                  where "file_type" = 'full' 
                  group by "table_name", "bundle", "text_file") s 
               on s."bundle" = ds."bundle" and s."table_name" = ds."table_name" and s."text_file" = ds."text_file"
              Join 
              (   select "table_name", "bundle", "text_file", max("end_time") as end_time 
                  from FDS_FDS_FILE_HISTORY 
                  where "file_type" = 'update' 
                  group by "table_name", "bundle", "text_file") s2 
              on s2."bundle" = ds."bundle" and s2."table_name" =  ds."table_name" and s2."text_file" = ds."text_file" 
  Order by 
              ds."schema_name" asc, ds."bundle" asc, s2.end_time desc )
  </code></pre>
  
  <p>Expected result is i should not get the error and actual result is ===>when i run the same query in ORACLE SQL Developer it runs perfectly but does not run in excel VBA module.</p>