<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to find a specific value in an Oracle database in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754366#M39110</link>
    <description>Oracle, like SAS, has dictionary tables.&lt;BR /&gt;&lt;A href="https://docs.oracle.com/cd/B19306_01/server.102/b14220/datadict.htm" target="_blank"&gt;https://docs.oracle.com/cd/B19306_01/server.102/b14220/datadict.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You could search all tables for all values but it would be very resource intensive - are you trying to search for a variable or a value?&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 15 Jul 2021 15:29:53 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-07-15T15:29:53Z</dc:date>
    <item>
      <title>How to find a specific value in an Oracle database</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754364#M39109</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like many organizations, we have many databases which contains many tables and for which we have little documentation. So, in some case, it is difficult to find the good table to carry out some tasks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I wonder it there is a way to find a specific value into a table.&lt;/P&gt;
&lt;P&gt;For example, imagine that we have the oracle data base named dbase1 which contains many tables and I would like to look&amp;nbsp; into each table and retains only the table name containing a specific value, let's say the value test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there an efficient way to do that in sas.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 15:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754364#M39109</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-07-15T15:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a specific value in an Oracle database</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754366#M39110</link>
      <description>Oracle, like SAS, has dictionary tables.&lt;BR /&gt;&lt;A href="https://docs.oracle.com/cd/B19306_01/server.102/b14220/datadict.htm" target="_blank"&gt;https://docs.oracle.com/cd/B19306_01/server.102/b14220/datadict.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You could search all tables for all values but it would be very resource intensive - are you trying to search for a variable or a value?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jul 2021 15:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754366#M39110</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-15T15:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a specific value in an Oracle database</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754372#M39111</link>
      <description>I want to look for few specific string value and hopefully those will appears into the same tables.  Then I would look at those table to select which one will be more sustainable for my needs.&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jul 2021 15:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754372#M39111</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-07-15T15:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a specific value in an Oracle database</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754375#M39112</link>
      <description>Do you have access to PASS THRU SQL?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://lalitkumarb.wordpress.com/2015/01/06/sql-to-search-for-a-value-in-all-columns-of-all-atbles-in-an-entire-schema/" target="_blank"&gt;https://lalitkumarb.wordpress.com/2015/01/06/sql-to-search-for-a-value-in-all-columns-of-all-atbles-in-an-entire-schema/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or you can use a SAS data step + CALL EXECUTE/DOSUBL to generate and run the same code. It will take a long time.</description>
      <pubDate>Thu, 15 Jul 2021 15:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754375#M39112</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-15T15:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a specific value in an Oracle database</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754438#M39121</link>
      <description>&lt;P&gt;Surely you have staff in your organisation that are responsible for creating and maintaining the tables in these databases. Why not ask them to help find the best source of the data you are looking for? A data dictionary wont tell you what is the best or most appropriate source for the data you want.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 20:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754438#M39121</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-07-15T20:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a specific value in an Oracle database</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754617#M39132</link>
      <description>Yes, I can use PASS THRU SQL</description>
      <pubDate>Fri, 16 Jul 2021 15:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/754617#M39132</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-07-16T15:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a specific value in an Oracle database</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/756088#M39174</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have try many things.&amp;nbsp; The first table is populated but the table test1 and test2 are empty.&amp;nbsp; Of course due to that factor,&lt;/P&gt;
&lt;P&gt;I can't use the table cols for the last script.&amp;nbsp; Moreover, for the last script, I am getting this error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: ORACLE execute error: ORA-01008: not all variables bound.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Heres my codes.&amp;nbsp; Please note that some letter are replace by ??? for safety purpose.&lt;/P&gt;
&lt;P&gt;Also, I was note able to declare a val variable and to set it at predefined value such as KING, CFNAUL, in my case&lt;/P&gt;
&lt;P&gt;**********************&lt;/P&gt;
&lt;PRE&gt;SQL&amp;gt; variable val varchar2(10)
SQL&amp;gt; exec :val := 'KING'

PL/SQL procedure successfully completed.

SQL&amp;gt; SELECT DISTINCT SUBSTR (:val, 1, 11) "Searchword",
  2    SUBSTR (table_name, 1, 14) "Table",
  3    SUBSTR (column_name, 1, 14) "Column"
  4  FROM cols,
  5    TABLE (xmlsequence (dbms_xmlgen.getxmltype ('select '
  6    || column_name
  7    || ' from '
  8    || table_name
  9    || ' where upper('
 10    || column_name
 11    || ') like upper(''%'
 12    || :val
 13    || '%'')' ).extract ('ROWSET/ROW/*') ) ) t
 14  ORDER BY "Table"
 15  /&lt;BR /&gt;************************&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;***********************&lt;/P&gt;
&lt;P&gt;%let TblName=list_of_tables;&lt;BR /&gt;%let WantedValue='CFNAUL';&lt;BR /&gt;%let authdomain=ORACLE_SAS_???_HUBPROD;&lt;BR /&gt;%let path=%sysfunc(scan("&amp;amp;authdomain.",-1,"_"));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;working .....&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;connect to oracle(authdomain="&amp;amp;authdomain" path="&amp;amp;path");&lt;BR /&gt;&lt;BR /&gt;create table &amp;amp;TblName. as &lt;BR /&gt;select * from connection to oracle&lt;BR /&gt;( select (&amp;amp;WantedValue.) as val,&lt;BR /&gt;owner,&lt;BR /&gt;Table_Name,&lt;BR /&gt;Column_Name as Field_Name&lt;BR /&gt;&lt;BR /&gt;from all_tab_columns&lt;BR /&gt;)&lt;BR /&gt;order by owner, table_name, Field_Name;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not working.&amp;nbsp; The cols table as variables but no values.&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;connect to oracle(authdomain="&amp;amp;authdomain" path="&amp;amp;path");&lt;BR /&gt;&lt;BR /&gt;create table test as &lt;BR /&gt;select * from connection to oracle&lt;BR /&gt;( select (&amp;amp;WantedValue.) as val,&lt;BR /&gt;/* owner,*/&lt;BR /&gt;Table_Name,&lt;BR /&gt;Column_Name as Field_Name&lt;BR /&gt;&lt;BR /&gt;from cols&lt;BR /&gt;)&lt;BR /&gt;order by /*owner,*/ table_name, Field_Name;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not working.&amp;nbsp; The table cols has variables but no values.&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;connect to oracle(authdomain="&amp;amp;authdomain" path="&amp;amp;path");&lt;BR /&gt;&lt;BR /&gt;create table test2 as &lt;BR /&gt;select * from connection to oracle&lt;BR /&gt;( select *&lt;BR /&gt;&lt;BR /&gt;from cols&lt;BR /&gt;)&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This one , I can't use the table cols and I am getting a bounding error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;connect to oracle(authdomain="&amp;amp;authdomain" path="&amp;amp;path");&lt;BR /&gt;&lt;BR /&gt;create table &amp;amp;TblName. as &lt;BR /&gt;select * from connection to oracle&lt;BR /&gt;( select (&amp;amp;WantedValue.) as val,&lt;BR /&gt;&lt;BR /&gt;Table_Name,&lt;BR /&gt;Column_Name as Field_Name&lt;BR /&gt;&lt;BR /&gt;from all_tab_columns,&lt;BR /&gt;TABLE (xmlsequence (dbms_xmlgen.getxmltype ('select '&lt;BR /&gt;|| column_name&lt;BR /&gt;|| ' from '&lt;BR /&gt;|| table_name&lt;BR /&gt;|| ' where upper('&lt;BR /&gt;|| column_name&lt;BR /&gt;|| ') like upper(''%'&lt;BR /&gt;|| :val&lt;BR /&gt;|| '%'')' ).extract ('ROWSET/ROW/*') ) ) t&lt;/P&gt;
&lt;P&gt;);&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does someone could help me with those issue such as how to declare variable and assign value to it , while using&lt;/P&gt;
&lt;P&gt;the SQL pass through facility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, could I use another table then&amp;nbsp;all_tab_columns because the cols does not have value in it.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 22:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-find-a-specific-value-in-an-Oracle-database/m-p/756088#M39174</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-07-22T22:37:01Z</dc:date>
    </item>
  </channel>
</rss>

