oci_fetch

(PHP 5, PHP 7, PECL OCI8 >= 1.1.0)

oci_fetchFetches the next row into result-buffer

说锟斤拷

oci_fetch ( resource $statement ) : bool

oci_fetch() 锟斤拷取锟斤拷一锟叫o拷锟斤拷锟斤拷 SELECT 锟斤拷洌╋拷锟斤拷诓锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷

Note:

锟斤拷 PHP 5.0.0 之前锟侥版本锟斤拷锟斤拷使锟斤拷 ocifetch() 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷煤锟斤拷锟斤拷锟斤拷锟饺伙拷锟斤拷茫锟轿拷锟斤拷录锟斤拷锟斤拷锟轿� oci_fetch() 锟侥憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟窖憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟狡硷拷使锟矫★拷

锟斤拷锟斤拷

statement

锟斤拷效锟斤拷 OCI8 锟斤拷锟斤拷锟绞讹拷锟� 锟斤拷 oci_parse() 锟斤拷锟斤拷锟斤拷锟斤拷 oci_execute() 锟斤拷 REF CURSOR statement 锟斤拷识执锟叫★拷

锟斤拷锟斤拷值

Returns TRUE on success or FALSE if there are no more rows in the statement.

锟斤拷锟斤拷

Example #1 oci_fetch() with defined variables

<?php

$conn 
oci_connect('hr''welcome''localhost/XE');
if (!
$conn) {
    
$e oci_error();
    
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}

$sql 'SELECT location_id, city FROM locations WHERE location_id < 1200';
$stid oci_parse($conn$sql);

// The defines MUST be done before executing
oci_define_by_name($stid'LOCATION_ID'$locid);
oci_define_by_name($stid'CITY'$city);

oci_execute($stid);

// Each fetch populates the previously defined variables with the next row's data
while (oci_fetch($stid)) {
    echo 
"Location id $locid is $city<br>\n";
}

// Displays:
//   Location id 1000 is Roma
//   Location id 1100 is Venice

oci_free_statement($stid);
oci_close($conn);

?>

Example #2 oci_fetch() with oci_result()

<?php

$conn 
oci_connect('hr''welcome''localhost/XE');
if (!
$conn) {
    
$e oci_error();
    
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}

$sql 'SELECT location_id, city FROM locations WHERE location_id < 1200';
$stid oci_parse($conn$sql);
oci_execute($stid);

while (
oci_fetch($stid)) {
    echo 
oci_result($stid'LOCATION_ID') . " is ";
    echo 
oci_result($stid'CITY') . "<br>\n";
}

// Displays:
//   1000 is Roma
//   1100 is Venice

oci_free_statement($stid);
oci_close($conn);

?>

注锟斤拷

Note:

In PHP versions before 5.0.0 use ocifetch() instead. 锟节碉拷前锟芥本锟叫o拷锟缴的猴拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆憋拷使锟矫o拷锟斤拷锟窖撅拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷使锟矫★拷

锟轿硷拷

  • oci_define_by_name() - 锟斤拷 SELECT 锟斤拷使锟斤拷 PHP 锟斤拷锟斤拷锟斤拷为锟斤拷锟斤拷牟锟斤拷锟�
  • oci_fetch_all() - 锟斤拷取锟斤拷锟斤拷锟斤拷莸锟斤拷锟斤拷锟斤拷械锟揭伙拷锟斤拷锟斤拷锟�
  • oci_fetch_array() - Returns the next row from a query as an associative or numeric array
  • oci_fetch_assoc() - Returns the next row from a query as an associative array
  • oci_fetch_object() - Returns the next row from a query as an object
  • oci_fetch_row() - Returns the next row from a query as a numeric array
  • oci_result() - 锟斤拷锟斤拷锟斤拷取锟斤拷锟斤拷锟斤拷锟街段碉拷值