Use below query to get the sql text of a particular sid.

When the below script asks for input, enter the SID.

 col sql_text form a80
set lines 120
select sql_text from gv$sqltext where hash_value=
(select sql_hash_value from gv$session where sid=&1) 
order by piece
/


SQL> SQL>   2    3    4  
Enter value for 1: 285
old   2: (select sql_hash_value from gv$session where sid=&1)
new   2: (select sql_hash_value from gv$session where sid=285)

SQL_TEXT
--------------------------------------------------------------------------------
select sql_text from gv$sqltext where hash_value= (select sql_ha
sh_value from gv$session where sid=285) order by piece

2 rows selected.