PHP and OCI8 running subquery on a dataset

Bridget Arrington Source

I'm not sure if I am asking this the correct way, but I want to run a query on an Oracle database, fetch the result, and then run additional queries on that result dataset. Is that possible? I am trying to avoid another call to the database.

$query = "SELECT * FROM MY.TABLE "; 
$stid = oci_parse($connection, $query);
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS_OCI_RETURN_LOBS)) { 
//my code for the full dataset

Then I would like to do something like

$newDataset = runThisQuery("SELECT * FROM [oci dataset from above(what is that syntax?)] WHERE my_value = 1");
while($newRow = loop through $newDataset){
//my code for the subquery

Any suggestions?

To further describe my problem: I am getting a table of fields, and from that table I would like to extract the unique values of certain fields into their own php arrays.



comments powered by Disqus