accept u_name prompt ‘Enter User Name (Enter NONE if want SID specific query): ‘
accept s_id prompt ‘Enter SID (Enter 0 for Userspecific Query): ‘
select a.sid, b.sql_text, a.sql_id, c.spid, b.executions, b.disk_reads, b.elapsed_time, b.cpu_time, b.buffer_gets
from v$session a, v$sqlarea b, v$process c
where a.sql_id = b.sql_id(+)
and (a.username = upper(‘&u_name’) or a.sid = &s_id )
and a.paddr = c.addr
/