58 lines
1.3 KiB
MySQL
58 lines
1.3 KiB
MySQL
|
|
@@header
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
* Author : Vishal Gupta
|
||
|
|
* Purpose : Display SQL Text from SQLArea
|
||
|
|
* Parameters : 1 - SQL_ID
|
||
|
|
*
|
||
|
|
*
|
||
|
|
* Revision History:
|
||
|
|
* ===================
|
||
|
|
* Date Author Description
|
||
|
|
* --------- ------------ -----------------------------------------
|
||
|
|
* 22-Oct-15 Vishal Gupta Added FORCE_MATCHING_SIGNATURE in the output heading
|
||
|
|
* 08-Mar-12 Vishal Gupta Initial version
|
||
|
|
*
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
UNDEFINE sqlid
|
||
|
|
UNDEFINE force_matching_signature
|
||
|
|
|
||
|
|
DEFINE sqlid="&&1"
|
||
|
|
DEFINE force_matching_signature=""
|
||
|
|
|
||
|
|
SET long 4000000
|
||
|
|
SET longchunksize 400000
|
||
|
|
SET pages 0
|
||
|
|
set lines 300
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
COLUMN _force_matching_signature NEW_VALUE force_matching_signature NOPRINT
|
||
|
|
|
||
|
|
select to_char(s.force_matching_signature) "_force_matching_signature"
|
||
|
|
from gv$sqlarea s
|
||
|
|
WHERE s.sql_id = '&&sqlid'
|
||
|
|
and rownum = 1
|
||
|
|
;
|
||
|
|
|
||
|
|
|
||
|
|
Prompt ********************************************************
|
||
|
|
Prompt * SQL Text for SQLID = &&sqlid
|
||
|
|
Prompt * Force Matching Signature = &&force_matching_signature
|
||
|
|
Prompt ********************************************************
|
||
|
|
|
||
|
|
COLUMN sql_text HEADING "SQLText" FORMAT a200 WRAP
|
||
|
|
|
||
|
|
SELECT s.sql_fulltext sql_text
|
||
|
|
FROM gv$sqlarea s
|
||
|
|
WHERE s.sql_id = '&&sqlid'
|
||
|
|
and rownum = 1
|
||
|
|
;
|
||
|
|
|
||
|
|
|
||
|
|
@@footer
|