SQL> select decode(to_char(sysdate, 'd'),4,5,count(*))
from retrocharge_requests rr, retrocharge_request_items rri where
rr.retrocharge_request_id = rri.retrocharge_request_id and rr.marketplace_id =1
and rr.created_date_utc > sysdate - 1 and rri.request_item_reason_type =
'InstantRefund' and to_char(sysdate,'d') not in (4);
DECODE(TO_CHAR(SYSDATE,'D'),4,5,COUNT(*))
-----------------------------------------
5
SQL> select decode(to_char(sysdate,
'd'),1,6,7,6,count(*)) from retrocharge_requests rr, retrocharge_request_items
rri where rr.retrocharge_request_id = rri.retrocharge_request_id and
rr.marketplace_id =1 and rr.created_date_utc > sysdate - 1 and rri.request_item_reason_type
= 'InstantRefund' and to_char(sysdate,'d') not in (1,7);
DECODE(TO_CHAR(SYSDATE,'D'),1,6,7,6,COUNT(*))
---------------------------------------------
660
SQL> select to_char(sysdate, 'day') from dual
2 ;
TO_CHAR(SYSDATE,'DAY')
---------------------------
wednesday
SQL> select to_char(sysdate, 'day') from dual where
to_char(sysdate, 'day')<>'wednesday';
no rows selected
SQL> select length(to_char(sysdate, 'day')) from dual
where to_char(sysdate, 'day')<>'wednesday';
no rows selected
SQL> select length(to_char(sysdate, 'day')) from dual;
LENGTH(TO_CHAR(SYSDATE,'DAY'))
------------------------------
9
SQL> select length(to_char(sysdate-1, 'day')) from dual;
LENGTH(TO_CHAR(SYSDATE-1,'DAY'))
--------------------------------
9
SQL> select length(to_char(sysdate, 'day')) from dual
where to_char(sysdate-1, 'day')<>'tuesday';
LENGTH(TO_CHAR(SYSDATE,'DAY'))
------------------------------
9
SQL> select length(to_char(sysdate, 'day')) from dual
where to_char(sysdate-1, 'day')<>'tuesday ';