<?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: Getting Exact Oracle errors returned by SQL from Shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373043#M868650</link>
    <description>Hi Friends &lt;BR /&gt;&lt;BR /&gt;Thanks for your suggestions we found that the reason for junk is for " * " in SQL output. &lt;BR /&gt;&lt;BR /&gt;so we have implemented as below &lt;BR /&gt;&lt;BR /&gt;SCRIPTERROR1=0 &lt;BR /&gt;sqlplus -s ystem/$spass @$SCRIPTNAME&amp;lt;$tmp/tmp.err &amp;gt; /tmp/com_outpu.txt &lt;BR /&gt;SCRIPTERROR1=$? &lt;BR /&gt;echo " " &lt;BR /&gt;echo " checking data " &lt;BR /&gt;echo " " &lt;BR /&gt;grep -Eq 'ORA-|SP2-' /tmp/com_outpu.txt &amp;gt; /dev/null &lt;BR /&gt;&lt;BR /&gt;if [ $? -eq 0 ]; then &lt;BR /&gt;echo " ************************************" &lt;BR /&gt;echo " ERROR 4" &lt;BR /&gt;echo "Error While droping " &lt;BR /&gt;cat /tmp/com_outpu.txt &lt;BR /&gt;echo "*********************************" &lt;BR /&gt;exit 1 &lt;BR /&gt;fi &lt;BR /&gt;</description>
    <pubDate>Tue, 07 Sep 2004 04:15:12 GMT</pubDate>
    <dc:creator>KVS Raju</dc:creator>
    <dc:date>2004-09-07T04:15:12Z</dc:date>
    <item>
      <title>Getting Exact Oracle errors returned by SQL from Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373040#M868647</link>
      <description>Dear friends.&lt;BR /&gt;Iam calling some SQL scripts from Shell sript (HP UNIX) in the following way.&lt;BR /&gt;&lt;BR /&gt;SCRIPTERROR1=0&lt;BR /&gt;SQLRESULTS1=`sqlplus -s user/$pass &lt;BR /&gt;@$SCRIPTNAME &amp;lt; $tmp/tmp.err`&lt;BR /&gt;&lt;BR /&gt;echo $SQLRESULTS1 | grep -Eq 'ORA-|SP2-'&lt;BR /&gt;GREPOUTPUT2=$?&lt;BR /&gt;if [ $GREPOUTPUT1 -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;             echo "********************************"&lt;BR /&gt;echo "ERROR 4 :"&lt;BR /&gt;echo "Error While droping:"                 echo "*******************************"&lt;BR /&gt;exit 99&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;The echo output of "$SQLRESULTS1" contains&lt;BR /&gt;some other junk data along with oracle errors. We observed that the echo output displaying all file names in that directory along with Oracle errors. &lt;BR /&gt;&lt;BR /&gt;Can please suggest me how to get only oracle errors in the echo output.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Sep 2004 09:34:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373040#M868647</guid>
      <dc:creator>KVS Raju</dc:creator>
      <dc:date>2004-09-06T09:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Exact Oracle errors returned by SQL from Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373041#M868648</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;not sure I read the script properly and/or if I understand fully yuor pb.&lt;BR /&gt;&lt;BR /&gt;Anyway :&lt;BR /&gt;1) I would check a return code for the sqlplus run&lt;BR /&gt;e.g.&lt;BR /&gt;SQLRESULTS1=$(sqlplus -s user/$pass &lt;BR /&gt;@$SCRIPTNAME &amp;gt; $tmp/tmp.err)&lt;BR /&gt;&lt;BR /&gt;RET=$?&lt;BR /&gt;&lt;BR /&gt;2) in your SQL I would start probably with :&lt;BR /&gt;whenever sqlerror exit 99 ;&lt;BR /&gt;(hence test of return code in (1))&lt;BR /&gt;&lt;BR /&gt;3) I would redirect output to the temp file (did I read it ok ?)&lt;BR /&gt;&lt;BR /&gt;then :&lt;BR /&gt;if [[ $RET -ne 0 ]]; then&lt;BR /&gt;  grep -e 'ORA-|SP2-' $tmp/tmp.err&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;you will get the errors &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jean-Luc&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Sep 2004 10:04:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373041#M868648</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2004-09-06T10:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Exact Oracle errors returned by SQL from Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373042#M868649</link>
      <description>Are you getting input from $tmp/tmp.err file for sql operation or redirecting it???&lt;BR /&gt;&lt;BR /&gt;If you want to put the contents on to $tmp/tmp.err file then, use as,&lt;BR /&gt;SQLRESULTS1=`sqlplus -s user/$pass&lt;BR /&gt;@$SCRIPTNAME &amp;gt; $tmp/tmp.err`&lt;BR /&gt;&lt;BR /&gt;Else to append with old contents then,&lt;BR /&gt;SQLRESULTS1=`sqlplus -s user/$pass&lt;BR /&gt;@$SCRIPTNAME &amp;gt;&amp;gt; $tmp/tmp.err`&lt;BR /&gt;&lt;BR /&gt;echo $SQLRESULTS1 | grep -Eq 'ORA-|SP2-'&lt;BR /&gt;GREPOUTPUT2=$?&lt;BR /&gt;if [ $GREPOUTPUT1 -eq 0 ]&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; we can simplify as,&lt;BR /&gt;echo $SQLRESULTS1 | grep -Eq 'ORA-|SP2-'&lt;BR /&gt;if [[ $? -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;And more you can start to debug *Everything* or this part with set -x ?&lt;BR /&gt;&lt;BR /&gt;set -x&lt;BR /&gt;SCRIPTERROR1=0&lt;BR /&gt;SQLRESULTS1=`sqlplus -s user/$pass&lt;BR /&gt;@$SCRIPTNAME &amp;gt; $tmp/tmp.err`&lt;BR /&gt;&lt;BR /&gt;echo $SQLRESULTS1 | egrep -q 'ORA-|SP2-'&lt;BR /&gt;if [ $? -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "********************************"&lt;BR /&gt;echo "ERROR 4 :"&lt;BR /&gt;echo "Error While droping:" &lt;BR /&gt;echo "*******************************"&lt;BR /&gt;exit 99&lt;BR /&gt;fi&lt;BR /&gt;set +x&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Sep 2004 10:42:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373042#M868649</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-09-06T10:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Exact Oracle errors returned by SQL from Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373043#M868650</link>
      <description>Hi Friends &lt;BR /&gt;&lt;BR /&gt;Thanks for your suggestions we found that the reason for junk is for " * " in SQL output. &lt;BR /&gt;&lt;BR /&gt;so we have implemented as below &lt;BR /&gt;&lt;BR /&gt;SCRIPTERROR1=0 &lt;BR /&gt;sqlplus -s ystem/$spass @$SCRIPTNAME&amp;lt;$tmp/tmp.err &amp;gt; /tmp/com_outpu.txt &lt;BR /&gt;SCRIPTERROR1=$? &lt;BR /&gt;echo " " &lt;BR /&gt;echo " checking data " &lt;BR /&gt;echo " " &lt;BR /&gt;grep -Eq 'ORA-|SP2-' /tmp/com_outpu.txt &amp;gt; /dev/null &lt;BR /&gt;&lt;BR /&gt;if [ $? -eq 0 ]; then &lt;BR /&gt;echo " ************************************" &lt;BR /&gt;echo " ERROR 4" &lt;BR /&gt;echo "Error While droping " &lt;BR /&gt;cat /tmp/com_outpu.txt &lt;BR /&gt;echo "*********************************" &lt;BR /&gt;exit 1 &lt;BR /&gt;fi &lt;BR /&gt;</description>
      <pubDate>Tue, 07 Sep 2004 04:15:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/getting-exact-oracle-errors-returned-by-sql-from-shell-script/m-p/3373043#M868650</guid>
      <dc:creator>KVS Raju</dc:creator>
      <dc:date>2004-09-07T04:15:12Z</dc:date>
    </item>
  </channel>
</rss>

