Fetching data using refcursor in a stroed procedure "; // Excute the call to the PL/SQL stored procedure // get coulmn heading $sql1 = "SELECT e.eid eid,e.info.fname fname,e.info.lname lname, e.info.address addr FROM empt1 e"; $stmt1 =oci_parse($conn, $sql1); oci_execute($stmt1); echo "uses oci_bind_name
". "call emp_proc1(:rc);end;"; // HEADER TABLE echo ""; echo ""; $ncols = oci_num_fields($stmt1); for ($i = 1; $i <= $ncols; $i++) { $column_name = oci_field_name($stmt1, $i); echo ""; } // echo "
$column_name
\n"; oci_free_statement($stmt1); $nrows = ""; // $stmt = oci_parse($conn, "call empt1_proc1(:rc)"); $refcur = oci_new_cursor($conn); oci_bind_by_name($stmt, ':rc', $refcur, -1, OCI_B_CURSOR); oci_execute($stmt); // Execute and fetch from the cursor oci_execute($refcur); // treat as a statement resource echo "\n"; while($row = oci_fetch_array($refcur, OCI_ASSOC)) { echo ""; $nrows++; foreach ($row as $conn) { echo ""; } echo "\n"; } echo "
$conn
\n"; echo " no of rows : ". $nrows; oci_free_statement($stmt); oci_close($conn); echo "
Oracle db connection closed"; ?>