title: Return value from sql script to shell script
body: <p>I have shell script that calls the following sql script:</p>
  
  <pre><code>     INSERT INTO SEMANTIC.COUNT_STATISTICS (...);
       UPDATE SEMANTIC.COUNT_STATISTICS 
       SET PRNCT_CHANGE = 1.1;
  
  
    --want to store result of this bellow select statement in model_count variable
  
        select PRNCT_CHANGE
        FROM SEMANTIC.COUNT_STATISTICS
        WHERE model = '&amp;MY_MODEL'
        AND NEW_DATE = (
                        select max(NEW_DATE)
                        from SEMANTIC.COUNT_STATISTICS
                        where MODEL = '&amp;MY_MODEL'
                       );
  </code></pre>
  
  <p>Now, how do I return this PERCENTAGE_NUMBER variable back to my shell script?</p>
  
  <p>My shell script is as follows:</p>
  
  <pre><code>#!/bin/bash
  #
  # setup oracle, java, and d2rq environment
  . /etc/profile.d/oracle.sh
  . /etc/profile.d/java.sh
  . /etc/profile.d/d2rq.sh
  
  cd /opt/D2RQ
  
  model_count=$(sqlplus user/pass @count.sql 'MODEL')
  
  if ["$model_count" &gt; 0]; then
     echo "percentage count is positive"
  else
     echo "its negative"
  </code></pre>
  
  <p>I would like for that last SELECT statement result to be stored into my model_count variable in shell script.</p>
  
  <p>Anyone knows why is not working?</p>