title: Change in variable lengths while passing from shell to sqlplus
body: <p>While passing 1 character variables from sqlplus to shell, I find this annoying anomaly.</p>
  
  <pre><code>echo "Please enter the upgrade option: "
  read type
  
  if [[ "$type" != "1" ]] &amp;&amp; [[ "$type" != "2" ]]
  then
              echo "You have entered an invalid response. Exiting."
      exit 0;
  fi
  
  sql_result=$($ORACLE_HOME/bin/sqlplus -s /nolog &lt;&lt;-EOF
  connect $eval_user/$eval_pass@$db_name
  
  SPOOL results.txt;
  WHENEVER OSERROR EXIT 9;
  
  DEFINE vType = '$type'
  DEFINE type_flag = '$t_flag'
  DEFINE vOrigowner = '$origOwner'
  @@EV_DBUPGRADE.sql '&amp;vType' '&amp;vOrigowner' '&amp;vAppConvFromDt' '&amp;vAppConvThruDt' '&amp;vAppConvStatusFlg' '&amp;type_flag'
  </code></pre>
  
  <p>Under EV_DBUPGRADE.sql, I find this error while using the variable vType:</p>
  
  <pre><code>vOption        varchar2(1)  := UPPER('&amp;1');
  </code></pre>
  
  <p>I get this annoying error that complains of buffer length</p>
  
  <pre><code>declare
  *
  ERROR at line 1:
  ORA-06502: PL/SQL: numeric or value error: character string buffer too small
  ORA-06512: at line 7
  </code></pre>
  
  <p>the error doesn't happen if the varchar2(10) is used. But, I don't want to change it in a million different places. Is there anyway to restrict it? And can anyone please tell me how to print debug messages in sqlplus outside of the BEGIN?</p>