title: mapfile cannot convert sql output to array variable
body: <p>I am trying to get a list of IDs from the oracle table and store it as an array variable. Trying to populate variables using mapfile did not work well. 10 rows returned from the query are treated as a single row. Parameter <code>-t</code> did not help.</p>
  <p>My plan is to use this array variable against another array (for which the .txt file will be a source) to cross-verify the existence of value.</p>
  <pre><code>#!/bin/sh
  
  temp_id_list=`sqlplus -silent ${o_schema_name}/${o_schema_pwd}@$o_db_name &lt;&lt;EOF 
  whenever sqlerror exit sql.sqlcode
  SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF 
  SELECT DISTINCT memid FROM members WHERE ROWNUM &lt; 11;
  EXIT;
  EOF`
  
  mapfile -t id_list &lt;&lt;&lt; ${temp_id_list}
  echo &quot;encoding details for a file : ${id_list[@]}&quot;
  echo &quot;Number of elements in id_list: ${#id_list[@]}&quot;    
  </code></pre>
  <p>The output of above is</p>
  <pre><code>values in array: 220000068 220000163 220000188 220000232 220000239 220000261 220000815 220000909 220000914 220001074
  Number of elements array: 1
  </code></pre>
  <p>To summarize, one column selected dynamically from a <code>|</code> delimited text file needs to be cross verified with an equivalent source available in the Oracle table. Table and flat-file both may have a huge amount of rows. So, trying to get a robust solution.</p>
  <p>Thanks in advance.</p>
  <p>Update: It is working after adding the variable into double quotes
  <code>mapfile -t id_list &lt;&lt;&lt; &quot;${temp_id_list}&quot;</code></p>