<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Returns number of rows affected during statement execution</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-num-fields.html">oci_num_fields</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-parse.html">oci_parse</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.oci-num-rows" class="refentry"> <div class="refnamediv"> <h1 class="refname">oci_num_rows</h1> <p class="verinfo">(PHP 5, PECL OCI8 >= 1.1.0)</p><p class="refpurpose"><span class="refname">oci_num_rows</span> — <span class="dc-title">Returns number of rows affected during statement execution</span></p> </div> <div class="refsect1 description" id="refsect1-function.oci-num-rows-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>oci_num_rows</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$statement</code></span> )</div> <p class="para rdfs-comment"> Gets the number of rows affected during statement execution. </p> </div> <div class="refsect1 parameters" id="refsect1-function.oci-num-rows-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">statement</code></em></span> <dd> <p class="para"> A valid OCI statement identifier. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.oci-num-rows-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the number of rows affected as an integer, or <strong><code>FALSE</code></strong> on errors. </p> </div> <div class="refsect1 examples" id="refsect1-function.oci-num-rows-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2012"> <p><strong>Example #1 <span class="function"><strong>oci_num_rows()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$conn </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"scott"</span><span style="color: #007700">, </span><span style="color: #DD0000">"tiger"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"create table emp2 as select * from emp"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">oci_num_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">) . </span><span style="color: #DD0000">" rows inserted.<br />"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">oci_free_statement</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"delete from emp2"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">, </span><span style="color: #0000BB">OCI_DEFAULT</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">oci_num_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">) . </span><span style="color: #DD0000">" rows deleted.<br />"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">oci_commit</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_free_statement</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"drop table emp2"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_free_statement</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">oci_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 notes" id="refsect1-function.oci-num-rows-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> This function <em class="emphasis">does not</em> return number of rows selected! For SELECT statements this function will return the number of rows, that were fetched to the buffer with <span class="function"><strong>oci_fetch*()</strong></span> functions. </p> </p></blockquote> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> In PHP versions before 5.0.0 you must use <span class="function"><a href="function.ocirowcount.html" class="function">ocirowcount()</a></span> instead. This name still can be used, it was left as alias of <span class="function"><strong>oci_num_rows()</strong></span> for downwards compatability. This, however, is deprecated and not recommended. </p> </p></blockquote> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-num-fields.html">oci_num_fields</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-parse.html">oci_parse</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>