with ash as (select /*+ materialize*/ CAST(sample_time AS DATE) as stime, s.* from &1) --SYSTEM.ASH_201901151747 s)--dba_hist_active_sess_history s where '&&2' is ...
with ash as (select /*+ materialize*/ CAST(sample_time AS DATE) as stime, s.* from dba_hist_active_sess_history s where '&&2' is null OR snap_id between '&&2' and nvl ...