To get number of rows from SELECT, use ocirowcount function instead of oci_num_rows().
Though this is an alias of oci_num_rows, the behavior for this is different as oci_num_rows will return you only rows affected by DML statements
(PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
ocirowcount — Alias of oci_num_rows()
This alias has been DEPRECATED as of PHP 5.4.0. Relying on this alias is highly discouraged.
add a note User Contributed Notes ocirowcount - [1 notes]