<?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: Error Handling - Oracle SQL in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3833000#M779014</link>
    <description>Add the following two lines to the very top of your $SQL/inventory.sql file:&lt;BR /&gt;&lt;BR /&gt;whenever sqlerror exit sql.sqlcode rollback&lt;BR /&gt;whenever oserror exit oscode rollback&lt;BR /&gt;&lt;BR /&gt;this prevents your session from making half-baked changes to the database since all the insert/update/delete statements will be rolled back in case of SQL and/or OS errors. No need to rollback selects as they are read only.&lt;BR /&gt;&lt;BR /&gt;hope it helps!</description>
    <pubDate>Fri, 28 Jul 2006 23:08:15 GMT</pubDate>
    <dc:creator>Sandman!</dc:creator>
    <dc:date>2006-07-28T23:08:15Z</dc:date>
    <item>
      <title>Error Handling - Oracle SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3832997#M779011</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;One of my shell script calls the following SQL.&lt;BR /&gt;&lt;BR /&gt;echo $ORA_PW|sqlplus $ORA_ID@$DB @$SQL/inventory.sql 1&amp;gt;$LOG/inventory.log 2&amp;gt;$STD_ERR/inventory.err&lt;BR /&gt;&lt;BR /&gt;I usually read the log file to see if there are any SQL errors and abend the job&lt;BR /&gt;(autosys job which calls my shell script) if there are any.&lt;BR /&gt;&lt;BR /&gt;Question:&lt;BR /&gt;I want to know what are the other possible ways to handle the SQL errors within shell script without reading log files ? &lt;BR /&gt;&lt;BR /&gt;1) After calling the SQL , in the next line i tried putting " if [ $? != 0 ]  " it always returning 0 irrespective of success/failure of above SQL.&lt;BR /&gt;&lt;BR /&gt;Any HELP!!!!!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Jul 2006 12:01:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3832997#M779011</guid>
      <dc:creator>uform</dc:creator>
      <dc:date>2006-07-28T12:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error Handling - Oracle SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3832998#M779012</link>
      <description>If you add the following to the beginning of your SQL script it should give you a non-zero return code on errors:&lt;BR /&gt;&lt;BR /&gt;whenever sqlerror exit sql.sqlcode&lt;BR /&gt;&lt;BR /&gt;Just note that it will exit sqlplus at the point of the error and not continue on.</description>
      <pubDate>Fri, 28 Jul 2006 12:18:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3832998#M779012</guid>
      <dc:creator>Jonathan Fife</dc:creator>
      <dc:date>2006-07-28T12:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error Handling - Oracle SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3832999#M779013</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here's the syntax for the "WHENEVER SQLERROR" command:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://lbd.epfl.ch/f/teaching/courses/oracle8i/server.815/a66736/ch8b26.htm" target="_blank"&gt;http://lbd.epfl.ch/f/teaching/courses/oracle8i/server.815/a66736/ch8b26.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Note that "WHENEVER SQLERROR" works for most, but not all Oracle errors.&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Fri, 28 Jul 2006 13:06:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3832999#M779013</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-07-28T13:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Error Handling - Oracle SQL</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3833000#M779014</link>
      <description>Add the following two lines to the very top of your $SQL/inventory.sql file:&lt;BR /&gt;&lt;BR /&gt;whenever sqlerror exit sql.sqlcode rollback&lt;BR /&gt;whenever oserror exit oscode rollback&lt;BR /&gt;&lt;BR /&gt;this prevents your session from making half-baked changes to the database since all the insert/update/delete statements will be rolled back in case of SQL and/or OS errors. No need to rollback selects as they are read only.&lt;BR /&gt;&lt;BR /&gt;hope it helps!</description>
      <pubDate>Fri, 28 Jul 2006 23:08:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-handling-oracle-sql/m-p/3833000#M779014</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-07-28T23:08:15Z</dc:date>
    </item>
  </channel>
</rss>

