@@header

/*
*
*  Author     : Vishal Gupta
*  Purpose    : Search source code
*  Parameters : 1 - Search Text (% - wildchar, \ - escape char)
*               
*
*  Revision History:
*  ===================
*  Date       Author        Description
*  ---------  ------------  -----------------------------------------
*  15-May-12  Vishal Gupta  Intial version
*
*
*/


UNDEFINE searchtext
UNDEFINE owner

DEFINE searchtext="&&1"
DEFINE owner="&&2"

COLUMN object_name       HEADING "Object Name"    FORMAT a40
COLUMN text              HEADING "Query"          FORMAT a150

set long 400000
set pages 1000

Prompt 
Prompt   ************************************************************
Prompt   ** Listing SourceCode with '&&searchtext'
Prompt   ************************************************************

SELECT s.owner || '.' || s.name object_name
     , s.type
     , s.line
     , s.text
  FROM dba_source s
 WHERE UPPER(s.text) like upper('&&searchtext') ESCAPE  '\'
   AND s.owner like upper('&&owner')
ORDER BY object_name
       , s.line 
;   

@@footer
