SQLText - Displays text of SQL for a specific SQL address
--
--  Name: sqltext_address.sql
--
--  Parms: 
--     #1: address
--
--  Description: SQLText - Displays text of SQL for a specific SQL address
--               Address can be found in different other views such as:
--                  . address of v$sqlarea
--                  . sql_address of v$session, etc.
--                   
--  Compatability: 7.3.x and above
--
--  Author: 
--
--  Usage: @sqltext_address address
--         @sqltext_address 00000004018AD4F8
--
--  Revision History:
--
--  DATE       WHO		   WHAT
--  ---------  ----------  ------------------
--
-- save SQL*Plus settings:
--store set savesqlplus_settings.sql replace
-- set SQL*Plus settings:
set linesize 133
set pages 40
--
column sql_address noprint 
column username format a12 
column osuser format a20
break on osuser on username on sid skip 1 
select sql_text
from v$sqltext a
where address = '&&1'
order by ADDRESS, piece;


--
-- restore SQL*Plus settings:
--@savesqlplus_settings