array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.oci-num-rows.php', 1 => 'oci_num_rows', ), 'up' => array ( 0 => 'ref.oci8.php', 1 => 'OCI8 函数', ), 'prev' => array ( 0 => 'function.oci-num-fields.php', 1 => 'oci_num_fields', ), 'next' => array ( 0 => 'function.oci-parse.php', 1 => 'oci_parse', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/oci8/functions/oci-num-rows.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8, PECL OCI8 >= 1.1.0)
oci_num_rows — 返回语句执行后受影响的行数
statement
有效的 OCI 语句标识符。
返回 int 类型的受影响的行数, 或者在失败时返回 false
。
示例 #1 oci_num_rows() 示例
<?php
$conn = oci_connect("hr", "hrpwd", "localhost/XE");
if (!$conn) {
$m = oci_error();
trigger_error(htmlentities($m['message']), E_USER_ERROR);
}
$stid = oci_parse($conn, "create table emp2 as select * from employees");
oci_execute($stid);
echo oci_num_rows($stid) . " rows inserted.<br />\n";
oci_free_statement($stid);
$stid = oci_parse($conn, "delete from emp2");
oci_execute($stid, OCI_DEFAULT);
echo oci_num_rows($stid) . " rows deleted.<br />\n";
oci_commit($conn);
oci_free_statement($stid);
$stid = oci_parse($conn, "drop table emp2");
oci_execute($stid);
oci_free_statement($stid);
oci_close($conn);
?>
注意:
本函数并不返回 SELECT 查询出来的行数!对于 SELECT 语句本函数将返回用 oci_fetch*() 函数从缓冲区获取的行数。