What are the potential pitfalls of using oci_num_rows in PHP5 for OCI (Oracle) compared to mysql_num_rows in MySQL?

The potential pitfall of using oci_num_rows in PHP5 for OCI (Oracle) compared to mysql_num_rows in MySQL is that oci_num_rows may not work as expected in all situations, especially when dealing with certain types of queries or result sets. To solve this issue, it is recommended to use a different approach to retrieve the number of rows affected by a query in Oracle, such as using a SELECT COUNT(*) query or fetching the rows into an array and counting the elements.

// Using a SELECT COUNT(*) query to retrieve the number of rows affected
$query = "SELECT COUNT(*) FROM your_table WHERE your_condition";
$result = oci_parse($conn, $query);
oci_execute($result);
$row = oci_fetch_array($result);
$num_rows = $row[0];
oci_free_statement($result);

echo "Number of rows affected: " . $num_rows;