Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: ora_fetch_into - Manual
[go: Go Back, main page]

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

search for in the

ora_fetch" width="11" height="7"/> <ora_exec
Last updated: Wed, 01 Nov 2006
view this page in

ora_fetch_into

(PHP 3, PHP 4, PHP 5 <= 5.1.0RC1)

ora_fetch_into -- 指定した配列resultにレコードを取得する

説明

int ora_fetch_into ( resource cursor, array &result [, int flags] )

データ行を配列にフェッチします。 flags には 2 種類あります。 ORA_FETCHINTO_NULLS が指定された場合、 NULL 値を持つカラムは配列にセットされますが、 ORA_FETCHINTO_ASSOC が指定された場合、 連想配列が生成されます。

フェッチされたから無数を返します。

例 1. ora_fetch_into() の使用例

<?php
$results
= array();
ora_fetch_into($cursor, $results);
echo
$results[0];
echo
$results[1];
$results = array();
ora_fetch_into($cursor, $results, ORA_FETCHINTO_NULLS|ORA_FETCHINTO_ASSOC);
echo
$results['MyColumn'];
?>

ora_parse(),ora_exec(), ora_fetch(), ora_do()も参照 ください。



add a note add a note User Contributed Notes
ora_fetch_into
HERVE3D
15-Feb-2006 06:57
With : ora_fetch_into($curs, &$dt, ORA_FETCHINTO_ASSOC)
If the value of a field is NULL it will contains value from the row before.

To avoid this you can use :
ora_fetch_into($curs, $dt, ORA_FETCHINTO_NULLS|ORA_FETCHINTO_ASSOC);
And NULL fields remain empty.
kamas at telkom dot net
04-Jun-2003 05:19
becareful when fetching data with NULL value using ora_fetch_into().
table example :
field1    field2    nullable
----------------------
a    b    c
w    w    NULL
d    d    NULL
e    e    x

//php script :
$curs = ora_open($conn);
ora_parse($curs, "SELECT * FROM tableblah");
ora_exec($curs);
while(ora_fetch_into($curs, &$dt, ORA_FETCHINTO_ASSOC)) {
   echo $dt['field1'] . " - " . $dt['field2'] . " - " . $dt['nullable'] . "<br>\n";
}
ora_close($curs);

the above code will print:
a - b - c
w - w - c
d - d - c
e - e - x

if the value of the nullable field is NULL it will contains value from the
row before. to avoid this you can use :

while(ora_fetch_into($curs, &$dt, ORA_FETCHINTO_ASSOC)) {
   ...
   $dt['nullable'] = "";
}

to set $dt['nullable'] to an empty value.
Markus dot Elfring at web dot de
31-May-2002 08:33
The function "OCIFetchInto" seems to be better for special datatypes like "CLOB" or "BLOB".

ora_fetch" width="11" height="7"/> <ora_exec
Last updated: Wed, 01 Nov 2006
 
 
show source | credits | sitemap | contact | advertising | mirror sites