oci_field_is_null
(PHP 5, PHP 7, PHP 8, PECL OCI8 >= 1.1.0)
oci_field_is_null — 检查字段是否为 null
说明
如果 statement
语句结果中返回的
field
字段的值是
null
,oci_field_is_null() 返回
true
。field
参数可以是字段的索引或字段名(大写字母)。
注意:
在 PHP 5.0.0 之前的版本必须使用 ocicolumnisnull() 替代本函数。该函数名仍然可用,为向下兼容作为 oci_field_is_null() 的别名。不过其已被废弃,不推荐使用。

User Contributed Notes 1 note
Raju Joseph [RajuJoseph at usa dot net] ¶
18 years ago
<?php
// Connect to Oracle database.
// Username : Raju
// Password : Password
// Database : Database_name
$conn=OCILogon("Raju", "Password", "DATABASE_NAME");
if ( ! $conn ) {
echo "Unable to connect: " . var_dump( OCIError() );
die();
}
// Select Data...
// DESC[RIBE] COMPANY
// CompanyID VARCHAR2(10)
// CompanyName VARCHAR2(30)
// LastUserID VARCHAR2(15)
// LastDate DATE
//
$query = "SELECT * FROM Company";
$result = OCIParse($conn, $query);
OCIExecute($result, OCI_DEFAULT);
while (OCIFetchInto ($result, $row, OCI_ASSOC)) {
// Usage of OCIcolumnisnull()
if (OCIcolumnisnull($result, 'CompanyName')) {
print ( "<P>" . $row['CompanyID'] . "--->" . "Company Name NOT found !! " . "<P>" );
}
else {
print ("<P>" . $row['CompanyID'] . "--->" . $row['CompanyName'] . "<P>" );
}
}
// Close connection from Oracle...
OCILogoff($conn);
?>
备份地址:http://www.lvesu.com/blog/php/function.oci-field-is-null.php