oci_num_rows
(PHP 5, PHP 7, PHP 8, PECL OCI8 >= 1.1.0)
oci_num_rows — 명령문 실행 중 영향을 받는 행 수를 반환합니다.
설명
oci_num_rows(resource $statement
): int|false
명령문 실행 중에 영향을 받는 행 수를 가져옵니다.
매개변수
statement
- 유효한 OCI 문 식별자입니다.
반환 값
영향을 받는 행 수를 정수로 반환하거나 실패 시 false
를 반환합니다.
Examples
예제 #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 문의 경우 이 함수는 oci_fetch*() 함수로 버퍼에 가져온 행 수를 반환합니다.
메모: PHP 5.0.0 이전 버전에서는 대신 ocirowcount()을 사용해야 합니다. 이 이름은 여전히 사용할 수 있으며 하위 호환성을 위해 oci_num_rows() 의 별칭으로 남겨졌습니다. 그러나 이것은 더 이상 사용되지 않으며 권장되지 않습니다.