<?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: Sqlplus subshell question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168565#M681771</link>
    <description>Maybe give this a twirl?  This way, we're ensuring that the value from the outer script is firmly exported into its environment, so it *should* be automagically adopted by the subshell:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;. $HOME/.bashrc&lt;BR /&gt;&lt;BR /&gt;for i in `cat ~allanm/list`&lt;BR /&gt;do&lt;BR /&gt;( export i_out=$i&lt;BR /&gt;~allanm/bin/sql_db1 passwd &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;BR /&gt;select COM_1 from table_1 where COM_2=$i_out&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;)&lt;BR /&gt;done&lt;BR /&gt;</description>
    <pubDate>Tue, 07 Apr 2009 18:43:07 GMT</pubDate>
    <dc:creator>Michael Mike Reaser</dc:creator>
    <dc:date>2009-04-07T18:43:07Z</dc:date>
    <item>
      <title>Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168561#M681767</link>
      <description>In the following script the value of $i is not being picked up within the sqlplus subshell...&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;. $HOME/.bashrc&lt;BR /&gt;&lt;BR /&gt;for i in `cat ~allanm/list`&lt;BR /&gt;do&lt;BR /&gt;(~allanm/bin/sql_db1 passwd &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;BR /&gt;select COM_1 from table_1 where COM_2=$i&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;)&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Can you figure out why? and how to pass it ...&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Allan</description>
      <pubDate>Tue, 07 Apr 2009 18:00:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168561#M681767</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-04-07T18:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168562#M681768</link>
      <description>Hi AllanM,&lt;BR /&gt;&lt;BR /&gt;Do a set -x up top in that script.&lt;BR /&gt;I suspect $i is not being set.&lt;BR /&gt;&lt;BR /&gt;My $0.02,&lt;BR /&gt;Jeff</description>
      <pubDate>Tue, 07 Apr 2009 18:03:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168562#M681768</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2009-04-07T18:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168563#M681769</link>
      <description>Well the value of $i is picked up outside of the subshell but not inside I believe. The question is how to pass $i to the sqlplus subshell.</description>
      <pubDate>Tue, 07 Apr 2009 18:12:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168563#M681769</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-04-07T18:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168564#M681770</link>
      <description>I just ran an update instead of a select and it didnt make a change to the table. So $i's value is not getting passed to the sql statement. Has anybody experienced this before.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Allan</description>
      <pubDate>Tue, 07 Apr 2009 18:33:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168564#M681770</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-04-07T18:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168565#M681771</link>
      <description>Maybe give this a twirl?  This way, we're ensuring that the value from the outer script is firmly exported into its environment, so it *should* be automagically adopted by the subshell:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;. $HOME/.bashrc&lt;BR /&gt;&lt;BR /&gt;for i in `cat ~allanm/list`&lt;BR /&gt;do&lt;BR /&gt;( export i_out=$i&lt;BR /&gt;~allanm/bin/sql_db1 passwd &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;BR /&gt;select COM_1 from table_1 where COM_2=$i_out&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;)&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Apr 2009 18:43:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168565#M681771</guid>
      <dc:creator>Michael Mike Reaser</dc:creator>
      <dc:date>2009-04-07T18:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168566#M681772</link>
      <description>Thanks for replying, the subshell also catches the value but not the sql statement itself. I am lost :(&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Apr 2009 19:34:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168566#M681772</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-04-07T19:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168567#M681773</link>
      <description>Hi Allan:&lt;BR /&gt;&lt;BR /&gt;Try changing:&lt;BR /&gt;&lt;BR /&gt;select COM_1 from table_1 where COM_2=$i&lt;BR /&gt;&lt;BR /&gt;...to:&lt;BR /&gt;&lt;BR /&gt;$(select COM_1 from table_1 where COM_2=$i)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Apr 2009 19:44:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168567#M681773</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-07T19:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168568#M681774</link>
      <description>Hi (again) Allan:&lt;BR /&gt;&lt;BR /&gt;By the way, save a process and eliminate the 'cat'.  Let the shell do the work of reading your input.&lt;BR /&gt;&lt;BR /&gt;Instead of:&lt;BR /&gt;&lt;BR /&gt;for i in `cat ~allanm/list`&lt;BR /&gt;&lt;BR /&gt;...which would be better written:&lt;BR /&gt;&lt;BR /&gt;for i in $(cat ~allanm/list)&lt;BR /&gt;&lt;BR /&gt;...but still wastes a process, do:&lt;BR /&gt;&lt;BR /&gt;for i in $(&amp;lt; ~allanm/list)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 07 Apr 2009 19:58:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168568#M681774</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-07T19:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168569#M681775</link>
      <description>JRF , that didnt work either :-(</description>
      <pubDate>Tue, 07 Apr 2009 21:24:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168569#M681775</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-04-07T21:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168570#M681776</link>
      <description>Ok found out ... the select statement required a semi-colon after the statement.</description>
      <pubDate>Tue, 07 Apr 2009 21:57:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168570#M681776</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-04-07T21:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sqlplus subshell question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168571#M681777</link>
      <description>Thanks All!</description>
      <pubDate>Tue, 07 Apr 2009 21:58:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sqlplus-subshell-question/m-p/5168571#M681777</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-04-07T21:58:03Z</dc:date>
    </item>
  </channel>
</rss>

