List the SQL statement Held for a Specific Session ID

10g

--
-- List the SQL statement held for a specific Session ID.
--
 
SET PAUSE ON
SET PAUSE 'Press Return to Continue'
SET PAGESIZE 60
SET LINESIZE 300
SET VERIFY OFF
 
COLUMN sql_text FORMAT a60
 
SELECT oc.sql_text, oc.address, oc.hash_value, oc.sql_id
FROM   v$open_cursor oc
WHERE  oc.sid = &Session_ID
/

11g

--
-- List the SQL statement held for a specific Session ID.
--
 
SET PAUSE ON
SET PAUSE 'Press Return to Continue'
SET PAGESIZE 60
SET LINESIZE 300
SET VERIFY OFF
 
COLUMN sql_text FORMAT a60
 
SELECT oc.sql_id, oc.sql_text, oc.last_sql_active_time as "Last Run", oc.sql_exec_id, oc.address, oc.hash_value, oc.sql_id
FROM   v$open_cursor oc
WHERE  oc.sid = &Session_ID
/

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License