title: Getting Data into Host Arrays from Oracle PL/SQL
body: <p>I'd like to pull a column of data in a table into a host array.  In my table, DOB is an integer type. My C++ code looks like this:</p>
  
  <pre><code>EXEC SQL BEGIN DECLARE SECTION;
  int birthdays[10];
  EXEC SQL END DECLARE SECTION;
  
  ...//Code to connect with the database
  
  EXEC SQL EXECUTE
  DECLARE
      ...
  BEGIN
     SELECT DOB INTO :birthdays FROM DRIVER_LICENSE WHERE DL_NUMBER &lt; 10;
  END
  </code></pre>
  
  <p>The DOB column is of integer type, and the DL_NUMBERS in the DRIVER_LICENSE table are numbered from 0.  When I try to compile this, I get the error "PLS-S-00597, expression "BIRTHDAYS' in the INTO list is of wrong type"</p>
  
  <p>I can run the select if it's not in an EXECUTE. The C++ code:</p>
  
  <pre><code>EXEC SQL BEGIN DECLARE SECTION;
  int birthdays[10];
  EXEC SQL END DECLARE SECTION;
  
  SQL EXEC SELECT DOB INTO :birthdays FROM DRIVER_LICENSE WHERE DL_NUMBER &lt; 10;
  </code></pre>
  
  <p>Gives me the numbers from the DOB column of the DRIVER_LICENSE table.</p>
  
  <p>I'm trying to use PL/SQL to consolidate a lot of SQL calls to minimize communication with the server. I can get the information into the C++ birthdays array by looping through a cursor and assign values to the birthday array elements one at a time, but that seems really inefficient.</p>