<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pure Performance Inc &#187; database search</title>
	<atom:link href="http://www.pure-performance.com/tag/database-search/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pure-performance.com</link>
	<description>Web and PeopleSoft Consulting</description>
	<lastBuildDate>Fri, 02 Apr 2010 01:59:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Searching Oracle (Database/PLSQL)</title>
		<link>http://www.pure-performance.com/2009/01/searching-oracle-databaseplsql/</link>
		<comments>http://www.pure-performance.com/2009/01/searching-oracle-databaseplsql/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 14:46:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[database search]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://pure-performance.com/?p=16</guid>
		<description><![CDATA[During development things always change.  Column names change, columns may be added or removed from tables and so on.  When this happens, you need to go back to your PL/SQL programs and change the code. In some cases, you can just recompile the package or procedure to find the problems caused.   But that doesn't always catch everything, especially when you have dynamic SQL.  So you should always run a PL/SQL search to find the column or text that has changed.]]></description>
			<content:encoded><![CDATA[<div style="float:right;display:inline;margin:0px 0px 0px 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-1316867219585554";
/* 234x60, ppi */
google_ad_slot = "4700353166";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p><img class="alignleft size-full wp-image-31" title="Oracle Search" src="http://pure-performance.com/wp-content/uploads/2009/01/orasearch.jpg" alt="Oracle Search" width="117" height="114" /><br />
<h2>PL/SQL Search</h2>
<p>During development things always change.  Column names change, columns may be added or removed from tables and so on.  When this happens, you need to go back to your PL/SQL programs and change the code. In some cases, you can just recompile the package or procedure to find the problems caused.   But that doesn&#8217;t always catch everything, especially when you have dynamic SQL.  So you should always run a PL/SQL search to find the column or text that has changed.</p>
<p>To do this, we use the  Oracle Data dictionary view  XXX_SOURCE (USER_SOURCE,  ALL_SOURCE,  or DBA_SOURCE depending on your access ) .  With USER_SOURCE you do not specify the owner since it only returns the source for the schema you&#8217;re logged into.</p>
<p>Below are SQL statements to find the text you&#8217;re looking for.</p>
<p>Using USER_SOURCE</p>
<blockquote><p>SELECT type, name, line<br />
FROM USER_SOURCE<br />
WHERE UPPER(text) LIKE UPPER(&#8216;%&amp;SearchText%&#8217;);</p></blockquote>
<p>Using DBA_SOURCE, or ALL_SOURCE</p>
<blockquote><p>SELECT type, name, line<br />
FROM ALL_SOURCE<br />
WHERE OWNER = &#8216;&amp;SCHEMA&#8217;<br />
AND UPPER(text) LIKE UPPER(&#8216;%&amp;SearchText%&#8217;);</p></blockquote>
<p>When you run a query above in SQL*Plus  you will be prompted for the  search text. Then, enter what you&#8217;re  looking for and you&#8217;re on your way.  These queries will return the following database types that contain the string your looking for :</p>
<ul>
<li>Packages</li>
<li>Procedures</li>
<li>Functions</li>
<li>Triggers</li>
<li>Types</li>
</ul>
<h2>Database Search</h2>
<p>To search for a given string in an entire Oracle database schema check out this awesome procedure by  <a title="David Yahalom" href="http://www.authoritybase.com/" target="_blank">David Yahalom</a> :  <a title="Search forf a given string in a shcema" href="http://it.toolbox.com/blogs/david/search-for-a-given-string-in-all-fields-of-an-entire-schema-24074" target="_blank">search_db</a></p>
<p>If you have scripts or other methods to search an Oracle database, please add them in a comment.</p>
<div style="text-align:center;width:100%;"><div style="margin:0px 0px 0px 0px;"><script type="text/javascript"><!--
google_ad_client = "pub-1316867219585554";
/* 728x90, ppi */
google_ad_slot = "8229743782";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.pure-performance.com/2009/01/searching-oracle-databaseplsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
