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.user_name
from v$session a, v$open_cursor 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
/