略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: oci_field_is_null

2024-04-28

oci_field_is_null

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

oci_field_is_null检查字段是否为 null

说明

oci_field_is_null(resource $statement, mixed $field): bool

如果 statement 语句结果中返回的 field 字段的值是 nulloci_field_is_null() 返回 truefield 参数可以是字段的索引或字段名(大写字母)。

注意:

在 PHP 5.0.0 之前的版本必须使用 ocicolumnisnull() 替代本函数。该函数名仍然可用,为向下兼容作为 oci_field_is_null() 的别名。不过其已被废弃,不推荐使用。

add a noteadd a note

User Contributed Notes 1 note

up
0
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);
?>

官方地址:https://www.php.net/manual/en/function.oci-field-is-null.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3