title: Oracle OCI - How to obtain the number of rows in the select set without fetching
body: <p>Noob here (with regards to Oracle and OCI).</p>
  
  <p>I am writing a program to do some tasks for my company.  Amongst the tasks, I have to update an oracle database to keep it in synch with other actions.  </p>
  
  <p>I want to pre-allocate memory efficiently to hold the results of fetching on the select set.  In order to do that, I need to know how many rows are in the select set.  </p>
  
  <p>I could do it with 2 separate statements; first a SELECT COUNT statement, followed by a SELECT statement, but that is inefficient from a server point of view. I could also just execute my SELECT statement and dynamically allocate memory as rows are fetched from the select set, but that is inefficient from a client point of view.</p>
  
  <p>I want to simply execute the SELECT statement and, before fetching any rows, retrieve the number of matching rows in the select set.  </p>
  
  <p>But I cannot locate an attribute that has this information.<br>
  There is OCI_ATTR_ROW_COUNT but this is the number of rows FETCHED, not the total number of rows in the select set.
  Then there is OCI_ATTR_PARAM_COUNT which tells you the number of COLUMNS (seems useless because you already know how many columns you asked for in your SQL).</p>
  
  <p>Does anybody know how to obtain the select set row count prior to fetching?</p>
  
  <p>Thanks
  Josh</p>