This content has been marked as final. Show 6 replies
i have a query to audit user who are not login sice 2 days, but want to exclude those days which are holidays in calculations.
SELECT active_directory_user FROM SYSTEM_USERS WHERE active_directory_user IN
(SELECT DISTINCT active_directory_user FROM ADMIN.SESSION_AUDIT WHERE LOGON_TIME<SYSDATE-1);
how to exclude sunday for example?
select active_directory_user from system_users where active_directory_user in ( select distinct active_directory_user from admin.session_audit where logon_time <sysdate-decode(to_char(sysdate,'fmDAY'),'MONDAY',2,'SUNDAY',2,1) );
Mr. singh wrote:It is like this: Subtract 2 from SYSDATE if the day is MONDAY or SUNDAY. Else subtract 1.
function seen by first time "sysdate-decode".
can you please provide the documentation for this function "sysdate-decode"
where logon_time < sysdate - decode ( to_char(sysdate,'fmDAY'), 'MONDAY',2, 'SUNDAY',2,1 )