title: MariaDB equivalent to Oracle WHENEVER SQLERROR
body: <p>In Oracle's sqlplus, when writing script we can use the <code>WHENEVER SQLERROR</code> to detect/handle errors.</p>
  
  <p>e.g.</p>
  
  <pre><code>sqlplus /nolog -S &lt;&lt;EOF
  
  WHENEVER SQLERROR EXIT FAILURE ROLLBACK
  
  CONNECT /
  
  EXEC ThisProcThrowsAnError();
  
  QUIT
  
  EOF
  
  if [ ${?} -eq 0 ]
  then
     echo "Worked OK"
  else
     echo "Oh dear"
  fi
  </code></pre>
  
  <p>Is there an equivalent in MariaDB (<code>mysql</code> client)?</p>
  
  <p>Note, I am not just interested in stored procedure, but essentially any errors that could error whilst executing a script on MariaDB.</p>