<?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 Retrieving the values from a Table ???? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607972#M853979</link>
    <description>Hai all,&lt;BR /&gt;&lt;BR /&gt;I am facing a problem on selecting the values from the Table...&lt;BR /&gt;&lt;BR /&gt;Table Creation:&lt;BR /&gt;-------------------&lt;BR /&gt;Create table product(bat_in_dir varchar2(50),bat_out_dir varchar2(50));&lt;BR /&gt;&lt;BR /&gt;In the above two columns i am having 9 directories names &amp;amp; paths in each column..&lt;BR /&gt;&lt;BR /&gt;But i need to pass the output like below after getting the directory names from the table.Here the directory paths &amp;amp; names are not constant.&lt;BR /&gt;&lt;BR /&gt;For bat_in_dir:&lt;BR /&gt;-----------------------------&lt;BR /&gt;BAC_in1=/home/test/&lt;BR /&gt;BAC_in2=/test/&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt;BAC_in3=/product/ &lt;BR /&gt;&lt;BR /&gt;For bat_out_dir:&lt;BR /&gt;-----------------------------&lt;BR /&gt;BAC_out1=/home/test/&lt;BR /&gt;BAC_out2=/test/&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt;BAC_out9=/product/ &lt;BR /&gt;----------------------------------&lt;BR /&gt;&lt;BR /&gt;I used this below code to get the Output from the Table in HP-Unix platform...&lt;BR /&gt;&lt;BR /&gt;Example Shell Script:&lt;BR /&gt;-----------------------------------------------&lt;BR /&gt;v_filedate=`echo " select to_char(add_months(sysdate, -9),'MONYYYY') from dual; " |&lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s USERNAME/PASSWORD|tail -2 | head -1`;&lt;BR /&gt;echo $v_filedate;&lt;BR /&gt;-----------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Can any body help me???&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;Ra</description>
    <pubDate>Tue, 06 Nov 2001 09:00:29 GMT</pubDate>
    <dc:creator>Rajkumar_3</dc:creator>
    <dc:date>2001-11-06T09:00:29Z</dc:date>
    <item>
      <title>Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607972#M853979</link>
      <description>Hai all,&lt;BR /&gt;&lt;BR /&gt;I am facing a problem on selecting the values from the Table...&lt;BR /&gt;&lt;BR /&gt;Table Creation:&lt;BR /&gt;-------------------&lt;BR /&gt;Create table product(bat_in_dir varchar2(50),bat_out_dir varchar2(50));&lt;BR /&gt;&lt;BR /&gt;In the above two columns i am having 9 directories names &amp;amp; paths in each column..&lt;BR /&gt;&lt;BR /&gt;But i need to pass the output like below after getting the directory names from the table.Here the directory paths &amp;amp; names are not constant.&lt;BR /&gt;&lt;BR /&gt;For bat_in_dir:&lt;BR /&gt;-----------------------------&lt;BR /&gt;BAC_in1=/home/test/&lt;BR /&gt;BAC_in2=/test/&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt;BAC_in3=/product/ &lt;BR /&gt;&lt;BR /&gt;For bat_out_dir:&lt;BR /&gt;-----------------------------&lt;BR /&gt;BAC_out1=/home/test/&lt;BR /&gt;BAC_out2=/test/&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt; .&lt;BR /&gt;BAC_out9=/product/ &lt;BR /&gt;----------------------------------&lt;BR /&gt;&lt;BR /&gt;I used this below code to get the Output from the Table in HP-Unix platform...&lt;BR /&gt;&lt;BR /&gt;Example Shell Script:&lt;BR /&gt;-----------------------------------------------&lt;BR /&gt;v_filedate=`echo " select to_char(add_months(sysdate, -9),'MONYYYY') from dual; " |&lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s USERNAME/PASSWORD|tail -2 | head -1`;&lt;BR /&gt;echo $v_filedate;&lt;BR /&gt;-----------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Can any body help me???&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;Ra</description>
      <pubDate>Tue, 06 Nov 2001 09:00:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607972#M853979</guid>
      <dc:creator>Rajkumar_3</dc:creator>
      <dc:date>2001-11-06T09:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607973#M853980</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;1. How are you telling sqlplus which database to query?&lt;BR /&gt;&lt;BR /&gt;2. What does &lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s USERNAME/PASSWORD &amp;lt;&amp;lt; EOF&lt;BR /&gt;&amp;gt;select to_char(add_months(sysdate,-9),'MONYYYY') from dual&lt;BR /&gt;&amp;gt;EOF&lt;BR /&gt;yield?&lt;BR /&gt;&lt;BR /&gt;3. What is the relationship between the tables 'product' and 'dual'?</description>
      <pubDate>Tue, 06 Nov 2001 10:19:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607973#M853980</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2001-11-06T10:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607974#M853981</link>
      <description>How about putting your query into a file and then calling the file from a shell script, i.e. to use your example:&lt;BR /&gt;&lt;BR /&gt;---test.sql---&lt;BR /&gt;select to_char(add_months(sysdate, -9),'MONYYYY') from dual;&lt;BR /&gt;exit&lt;BR /&gt;-----end-----&lt;BR /&gt;&lt;BR /&gt;---test.sh---&lt;BR /&gt;PATH=$ORACLE_HOME/bin:$PATH&lt;BR /&gt;v_filedate=$(sqlplus -S USERNAME/PASSWORD @test.sql|tail -2|head -1)&lt;BR /&gt;echo $v_filedate;&lt;BR /&gt;-----end-----&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
      <pubDate>Tue, 06 Nov 2001 10:38:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607974#M853981</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-11-06T10:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607975#M853982</link>
      <description>Hai All,&lt;BR /&gt;&lt;BR /&gt;The query which i have given its just an example only..&lt;BR /&gt;The actual query looks like this...&lt;BR /&gt;----------------------------&lt;BR /&gt;v_filedate=`echo " select bat_in_dir,bat_out_dir from product; " |&lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s USERNAME/PASSWORD|tail -2 | head -1`;&lt;BR /&gt;echo $v_filedate;&lt;BR /&gt;-----------------------------&lt;BR /&gt;The above mentioned query may not be correct...&lt;BR /&gt;&lt;BR /&gt;The above script was executing successfully with out giving any rows..I want that two column output in to different varaibles as described above..&lt;BR /&gt;&lt;BR /&gt;My purpose is to delete some files depending upon the directories..The directories are not constant and we dont know which direcories they were.Thats the reason i have to select the directory paths from the table and delete the files stored in those directories in the OS...&lt;BR /&gt;&lt;BR /&gt;Can any one help me??&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards&lt;BR /&gt;Ra</description>
      <pubDate>Tue, 06 Nov 2001 11:24:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607975#M853982</guid>
      <dc:creator>Rajkumar_3</dc:creator>
      <dc:date>2001-11-06T11:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607976#M853983</link>
      <description>Hai santosh,&lt;BR /&gt;&lt;BR /&gt;Its hanging ..Whats the reason ????&lt;BR /&gt;&lt;BR /&gt;Raj</description>
      <pubDate>Tue, 06 Nov 2001 11:43:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607976#M853983</guid>
      <dc:creator>Rajkumar_3</dc:creator>
      <dc:date>2001-11-06T11:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607977#M853984</link>
      <description>Hi,&lt;BR /&gt;don't forget to put an "exit;" in the SQL-script.&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Thierry.</description>
      <pubDate>Tue, 06 Nov 2001 12:00:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607977#M853984</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2001-11-06T12:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607978#M853985</link>
      <description>Check that the username and password are set correctly for sqlplus.  The script hung on my system too when I didn't set the login info properly.  Basically, sqlplus is waiting for a proper login.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
      <pubDate>Tue, 06 Nov 2001 13:24:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607978#M853985</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-11-06T13:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607979#M853986</link>
      <description>Hai all,&lt;BR /&gt;&lt;BR /&gt;When i execute the script it is displaying that 23 rows was selected.But its not displaying all the rows&lt;BR /&gt;If there is one row then its displaying..&lt;BR /&gt;&lt;BR /&gt;What could be the reason ??&lt;BR /&gt;&lt;BR /&gt;Bye&lt;BR /&gt;Raj</description>
      <pubDate>Tue, 06 Nov 2001 13:29:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607979#M853986</guid>
      <dc:creator>Rajkumar_3</dc:creator>
      <dc:date>2001-11-06T13:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607980#M853987</link>
      <description>Hai all,&lt;BR /&gt;&lt;BR /&gt;Can any one can provide me a solution as above????&lt;BR /&gt;&lt;BR /&gt;Its Urjent please&lt;BR /&gt;&lt;BR /&gt;Raj</description>
      <pubDate>Tue, 06 Nov 2001 13:40:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607980#M853987</guid>
      <dc:creator>Rajkumar_3</dc:creator>
      <dc:date>2001-11-06T13:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607981#M853988</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;maybe a different approach is possible: creation of a delete script from within sqlplus:&lt;BR /&gt;&lt;BR /&gt;--- my.sql --&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;spool /tmp/mydelete.sh&lt;BR /&gt;select 'find ' || bac_in_dir || '  ' || bac_out_dir || ' -type f -mtime +270 -exec rm {} \;'&lt;BR /&gt;from dual;&lt;BR /&gt;spool off;&lt;BR /&gt;exit;&lt;BR /&gt;-- end my.sql ---&lt;BR /&gt;&lt;BR /&gt;-- start script&lt;BR /&gt;sqlplus -s u/p @my.sql&lt;BR /&gt;sh /tmp/mydelete.sh&lt;BR /&gt;-- end script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;that's it, the sql should generate something like:&lt;BR /&gt;find /home/test/ /home/test/ -type f -mtime +270 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;(if 'BAC_in1=' is included in the value, you will need to trim it)&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
      <pubDate>Tue, 06 Nov 2001 13:53:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607981#M853988</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2001-11-06T13:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607982#M853989</link>
      <description>Your answer lies in rewriting your script in perl:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.orafaq.org/faqperl.htm" target="_blank"&gt;http://www.orafaq.org/faqperl.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;v_filedate=`echo " select bat_in_dir,bat_out_dir from product; " | &lt;BR /&gt;$ORACLE_HOME/bin/sqlplus -s USERNAME/PASSWORD|tail -2 | head -1`; &lt;BR /&gt;echo $v_filedate;&lt;BR /&gt;&lt;BR /&gt;#!/pathtoperl/perl&lt;BR /&gt;         use strict;&lt;BR /&gt;         use DBI;&lt;BR /&gt;         my $dbh = DBI-&amp;gt;connect( 'dbi:Oracle:orcl',&lt;BR /&gt;                                 'USERNAMEHERE',&lt;BR /&gt;                                 'PASSWORDHERE',&lt;BR /&gt;                                 { RaiseError =&amp;gt; 1, AutoCommit =&amp;gt; 0 }&lt;BR /&gt;                               ) || die "Database connection not made: $DBI::errstr";&lt;BR /&gt; my $sql = qq{ select bat_in_dir,bat_out_dir from product };    &lt;BR /&gt; my $sth = $dbh-&amp;gt;prepare($sql);&lt;BR /&gt; $sth-&amp;gt;execute();&lt;BR /&gt;&lt;BR /&gt; my($indir, $outdir);                               # Declare columns&lt;BR /&gt; $sth-&amp;gt;bind_columns(\$indir, \$outdir);&lt;BR /&gt;&lt;BR /&gt; print "List:\n\n";              # Fetch rows from DB&lt;BR /&gt; while( $sth-&amp;gt;fetch() ) {&lt;BR /&gt;     print "$indir, $outdir \n";&lt;BR /&gt; }&lt;BR /&gt; $sth-&amp;gt;finish();                           # Close cursor&lt;BR /&gt;$dbh-&amp;gt;disconnect;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 06 Nov 2001 14:37:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607982#M853989</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-11-06T14:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607983#M853990</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Try this&lt;BR /&gt;&lt;BR /&gt;echo "&lt;BR /&gt;set heading off&lt;BR /&gt;set feedback off&lt;BR /&gt;set pagesize 0&lt;BR /&gt;select bat_in_dir from product&lt;BR /&gt;union all&lt;BR /&gt;select bat_out_dir from product;"|sqlplus -s USERNAME/PASSWORD|xargs rm -rf&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Jonas</description>
      <pubDate>Wed, 07 Nov 2001 14:46:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607983#M853990</guid>
      <dc:creator>Jonas Linden</dc:creator>
      <dc:date>2001-11-07T14:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the values from a Table ????</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607984#M853991</link>
      <description>Hai all,&lt;BR /&gt;&lt;BR /&gt;We cant remove the files directly...&lt;BR /&gt;&lt;BR /&gt;I have attached one shell script which will read the parameters from the property file ...That script i recieved in the FAQ prepared by Robin...&lt;BR /&gt;&lt;BR /&gt;so i have to follow in that way...Is it possible...&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Raj</description>
      <pubDate>Thu, 08 Nov 2001 03:33:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieving-the-values-from-a-table/m-p/2607984#M853991</guid>
      <dc:creator>Rajkumar_3</dc:creator>
      <dc:date>2001-11-08T03:33:03Z</dc:date>
    </item>
  </channel>
</rss>

