to_char,to_date转换

select count(a.total_sess) from (select to_date(to_char(sample_time, 'yyyy/mm/dd hh24:mi:ss'),
               'yyyy/mm/dd hh24:mi:ss'),
       count(*) as total_sess
  from v$active_session_history

 where to_date(to_char(sample_time, 'yyyy/mm/dd hh24:mi:ss'),
               'yyyy/mm/dd hh24:mi:ss') >
       to_date('2023/10/11 14:56:33', 'yyyy/mm/dd hh24:mi:ss')
   and to_date(to_char(sample_time, 'yyyy/mm/dd hh24:mi:ss'),
               'yyyy/mm/dd hh24:mi:ss') <
       to_date('2023/10/11 15:13:10', 'yyyy/mm/dd hh24:mi:ss')
 group by to_date(to_char(sample_time, 'yyyy/mm/dd hh24:mi:ss'),
                  'yyyy/mm/dd hh24:mi:ss')
 order by 2 desc) a;

你可能感兴趣的:(数据库,前端,linux)