"; $sql ='select department_name, cursor(select first_name from employees where employees.department_id = departments.department_id) as nc from departments where department_id in (10, 20, 30)'; $s = oci_parse($conn, $sql); $r = oci_execute($s); while (($row1 = oci_fetch_array($s, OCI_ASSOC)) != false) { echo "Department: " . $row1['DEPARTMENT_NAME'] . "
\n"; $nc = $row1['NC']; // treat as a statement resource oci_execute($nc); while (($row2 = oci_fetch_array($nc, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { echo $row2['FIRST_NAME'] . "
\n"; } oci_free_statement($nc); echo "
\n"; } ?>