title: Oracle Error Handling in Bash Script
body: <p>How can I error handling in SQLPlus , printing out customised messages when an error is encountered. I have put my code below. </p>
  
  <p>My Code</p>
  
  <pre><code>#!/bin/bash
  
      echo "My Scripts run below"
      sqlplus -S UID1/UID2@DB1&lt;&lt; EOF
      whenever sqlerror exit sql.sqlcode;
      @/path/Script1
      @/path/Script2
      exit;
      EOF
     echo "My Scripts have run"
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>My Scripts run below
  SP2-0310: unable to open file "/path/Script1.sql"
  SP2-0310: unable to open file "/path/Script2.sql"
  My Scripts have run
  </code></pre>
  
  <p><strong>Required Output</strong></p>
  
  <pre><code>My Scripts run below
  **Below error in Script1**
  SP2-0310: unable to open file "/path/Script1.sql"
  **Below error in Script2**
  SP2-0310: unable to open file "/path/Script2.sql"
  My Scripts have run
  </code></pre>