--The number of users connected on the environment at the moment
select count(Nr) USERS_NUMBER FROM ( SELECT count(OPRID) as Nr FROM PSACCESSLOG where to_date(sysdate)-to_date(LOGINDTTM)>=0 and to_date(LOGOUTDTTM)-to_date(sysdate)>=0 group by OPRID)
--The users connected on the environment at the moment
select DISTINCT OPRID, LOGIPADDRESS, TO_CHAR(LOGINDTTM ,'YYYY-MM-DD:hh:mi:ss') LOGINTIME,TO_CHAR(LOGOUTDTTM ,'YYYY-MM-DD:hh:mi:ss') LOGOUTIME, TO_CHAR((sysdate),'YYYY-MM-DD:hh:mi:ss') CURRTIME FROM PSACCESSLOG where to_date(sysdate)-to_date(LOGINDTTM)>=0 and to_date(LOGOUTDTTM)-to_date(sysdate)>=0