downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

oci_num_rows> <oci_new_descriptor
[edit] Last updated: Fri, 25 May 2012

view this page in

oci_num_fields

(PHP 5, PECL OCI8 >= 1.1.0)

oci_num_fieldsある文における結果のカラム数を返す

説明

int oci_num_fields ( resource $statement )

指定した文 statement におけるカラムの数を返します。

パラメータ

statement

有効な OCI ステートメント ID。

返り値

カラムの数を表す整数値、あるいはエラー時に FALSE を返します。

例1 oci_num_fields() の例

<?php
$conn 
oci_connect("scott""tiger");
$stmt oci_parse($conn"select * from emp");

oci_execute($stmt);

while (
oci_fetch($stmt)) {
    echo 
"\n";
    
$ncols oci_num_fields($stmt);
    for (
$i 1$i <= $ncols$i++) {
        
$column_name  oci_field_name($stmt$i);
        
$column_value oci_result($stmt$i);
        echo 
$column_name ': ' $column_value "\n";
    }
    echo 
"\n";
}

oci_free_statement($stmt);
oci_close($conn);
?>

注意

注意:

PHP バージョン 5.0.0 以前では、代わりに ocinumcols() を使用しなければなりません。 まだこの名前を使用することができ、下位互換性のため oci_num_fields() への別名として残されていますが、 推奨されません。



add a note add a note User Contributed Notes oci_num_fields
jnield at impole dot com 18-Nov-1999 07:43
The following is not immediately obvious:

If you need the number of columns in a REF CURSOR returned from a PL/SQL procedure, you need to use OCINumColumns() on the cursor handle returned by OCINewCursor after it is bound and executed, not the statement handle. Same applies for OCIColumnName() and friends.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites