<?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: unix + sql in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117273#M92850</link>
    <description>SQ_DB=database A&lt;BR /&gt; SQ_USER=&lt;BR /&gt; SQ_PASSWD=&lt;BR /&gt; EZS_DB=database B&lt;BR /&gt; EZS_USER=&lt;BR /&gt; EZS_PASSWD=&lt;BR /&gt; EZS_SQLFILE=/home/gppsq/temp/sample/ezs.sql&lt;BR /&gt; SQ_SQLFILE=/home/gppsq/temp/sample/sq.sql&lt;BR /&gt;&lt;BR /&gt;  #connect to first database &lt;BR /&gt;         mysqlstm=$(cat ${SQ_SQLFILE} | sqlplus -s $SQ_USER/$SQ_PASSWD@$SQ_DB);&lt;BR /&gt;&lt;BR /&gt;# here i get the result of the above sql file (SQ_SQLFILE) which is stored in the variable below (st)&lt;BR /&gt;&lt;BR /&gt;           st=`echo  ${mysqlstm}`&lt;BR /&gt;&lt;BR /&gt;             echo "$st" #output is a date (eg: 24-Jun-2007 ) &lt;BR /&gt;&lt;BR /&gt;now the question is how do i pass the result of sq.sqlfile ($st) to EZS_SQLFILE &lt;BR /&gt;&lt;BR /&gt;My EZS_SQLFILe has the below sql statements;&lt;BR /&gt;&lt;BR /&gt;select value1 from table_name where col2_date &amp;gt; '$st';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I tried the below&lt;BR /&gt;&lt;BR /&gt;sqlplus -s $EZS_USER/$EZS_PASSWD@$EZS_DB @/home/gppsq/temp/sample/ezs.sql $st&lt;BR /&gt;&lt;BR /&gt;but got error as &lt;BR /&gt;ERROR at line 1:&lt;BR /&gt;ORA-01858: a non-numeric character was found where a numeric was expected&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Gyan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 18 Dec 2007 16:55:11 GMT</pubDate>
    <dc:creator>Gyankr</dc:creator>
    <dc:date>2007-12-18T16:55:11Z</dc:date>
    <item>
      <title>unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117266#M92843</link>
      <description>I have a variable (say x) which i have to pass to a query (for eg. select col2 from table where update_date=(sysdate -x) ). Inturn i have to pass the result (col2 value) back to my unix script for further computation.&lt;BR /&gt;Is this possible?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Gyan</description>
      <pubDate>Sat, 15 Dec 2007 17:20:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117266#M92843</guid>
      <dc:creator>Gyankr</dc:creator>
      <dc:date>2007-12-15T17:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117267#M92844</link>
      <description>Hi Gyan:&lt;BR /&gt;&lt;BR /&gt;A Google for unix+sql returned these useful examples:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.orafaq.com/forum/t/48103/0/" target="_blank"&gt;http://www.orafaq.com/forum/t/48103/0/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.tek-tips.com/faqs.cfm?fid=2218" target="_blank"&gt;http://www.tek-tips.com/faqs.cfm?fid=2218&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 15 Dec 2007 18:49:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117267#M92844</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-12-15T18:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117268#M92845</link>
      <description>hi gyan ;&lt;BR /&gt;&lt;BR /&gt;look at fallowin url ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.dbasupport.com/forums/archive/index.php/t-9326.html" target="_blank"&gt;http://www.dbasupport.com/forums/archive/index.php/t-9326.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/csh -fb&lt;BR /&gt;set param ="3"&lt;BR /&gt;&lt;BR /&gt;sqlplus system/manager@orcl &amp;lt;&amp;lt; EOF | tee /tmp/$$TMP_FILE&lt;BR /&gt;select some_value from some_table where some_param = $param&lt;BR /&gt;EOF</description>
      <pubDate>Sat, 15 Dec 2007 19:37:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117268#M92845</guid>
      <dc:creator>Hasan  Atasoy</dc:creator>
      <dc:date>2007-12-15T19:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117269#M92846</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;print "\&lt;BR /&gt;$OraUsr/$OraPwd&lt;BR /&gt;set ver off feed off head off pages 0 lines 200 trim on&lt;BR /&gt;select col2 from table where update_date=(sysdate -$x);&lt;BR /&gt;exit;&lt;BR /&gt;"|sqlplus -s|read myvar&lt;BR /&gt;print myvar&lt;BR /&gt;&lt;BR /&gt;This piece of code retrun teh value of col2 into var myvar using shell variable $OraUse, $OraPwd, $x&lt;BR /&gt;&lt;BR /&gt;You can improve it a bit adding checks about errors.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;ART</description>
      <pubDate>Tue, 18 Dec 2007 11:09:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117269#M92846</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2007-12-18T11:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117270#M92847</link>
      <description>Or how about the following shell script:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;&lt;BR /&gt;VAR=$(sqlplus -s user/pass &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;select col2 from table&lt;BR /&gt;where update_date = (sysdate - x)&lt;BR /&gt;/&lt;BR /&gt;EOF)&lt;BR /&gt;&lt;BR /&gt;# now VAR has a value and is available for further computation&lt;BR /&gt;&lt;BR /&gt;echo $VAR</description>
      <pubDate>Tue, 18 Dec 2007 12:10:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117270#M92847</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-12-18T12:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117271#M92848</link>
      <description>Hello everybody,&lt;BR /&gt;Thanks for the suggestions. Can we decouple the unix and sql scripts separately.&lt;BR /&gt;I mean to call an sql file from unix shell and pass the result back to unix shells.</description>
      <pubDate>Tue, 18 Dec 2007 12:13:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117271#M92848</guid>
      <dc:creator>Gyankr</dc:creator>
      <dc:date>2007-12-18T12:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117272#M92849</link>
      <description>hi gyan,&lt;BR /&gt;&lt;BR /&gt;You can try to put the SQL statement in a file and then use the following:&lt;BR /&gt;&lt;BR /&gt;MYSQLSTMT=$(cat /home/yogeeraj/sql/sql01.sql)  &lt;BR /&gt;the rest is a matter of running the sql and retrieving the results.&lt;BR /&gt;&lt;BR /&gt;if you need further help, do let u know.&lt;BR /&gt;&lt;BR /&gt;Also if you have a piece of code that is not working, you can always post it here...&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Tue, 18 Dec 2007 13:37:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117272#M92849</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-12-18T13:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: unix + sql</title>
      <link>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117273#M92850</link>
      <description>SQ_DB=database A&lt;BR /&gt; SQ_USER=&lt;BR /&gt; SQ_PASSWD=&lt;BR /&gt; EZS_DB=database B&lt;BR /&gt; EZS_USER=&lt;BR /&gt; EZS_PASSWD=&lt;BR /&gt; EZS_SQLFILE=/home/gppsq/temp/sample/ezs.sql&lt;BR /&gt; SQ_SQLFILE=/home/gppsq/temp/sample/sq.sql&lt;BR /&gt;&lt;BR /&gt;  #connect to first database &lt;BR /&gt;         mysqlstm=$(cat ${SQ_SQLFILE} | sqlplus -s $SQ_USER/$SQ_PASSWD@$SQ_DB);&lt;BR /&gt;&lt;BR /&gt;# here i get the result of the above sql file (SQ_SQLFILE) which is stored in the variable below (st)&lt;BR /&gt;&lt;BR /&gt;           st=`echo  ${mysqlstm}`&lt;BR /&gt;&lt;BR /&gt;             echo "$st" #output is a date (eg: 24-Jun-2007 ) &lt;BR /&gt;&lt;BR /&gt;now the question is how do i pass the result of sq.sqlfile ($st) to EZS_SQLFILE &lt;BR /&gt;&lt;BR /&gt;My EZS_SQLFILe has the below sql statements;&lt;BR /&gt;&lt;BR /&gt;select value1 from table_name where col2_date &amp;gt; '$st';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I tried the below&lt;BR /&gt;&lt;BR /&gt;sqlplus -s $EZS_USER/$EZS_PASSWD@$EZS_DB @/home/gppsq/temp/sample/ezs.sql $st&lt;BR /&gt;&lt;BR /&gt;but got error as &lt;BR /&gt;ERROR at line 1:&lt;BR /&gt;ORA-01858: a non-numeric character was found where a numeric was expected&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Gyan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Dec 2007 16:55:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/unix-sql/m-p/4117273#M92850</guid>
      <dc:creator>Gyankr</dc:creator>
      <dc:date>2007-12-18T16:55:11Z</dc:date>
    </item>
  </channel>
</rss>

