ocicolumnisnull

(PHP 3>= 3.0.4, PHP 4 , PHP 5)

ocicolumnisnull -- Test whether a result column is NULL

Description

bool ocicolumnisnull ( resource stmt, mixed col)

ocicolumnisnull() returns TRUE if the returned column column in the result from the statement stmt is NULL. You can either use the column-number (1-Based) or the column-name, in uppercase, for the col parameter.

Note: This function was renamed to oci_field_is_null() after PHP >= 5.0.0. For downward compatibility ocicolumnisnull() can also be used. This is deprecated, however.

ont color="#0000BB"><?php
/* OCIBindByPos example thies at thieso dot net (980221)
  inserts 3 records into emp, and uses the ROWID for updating the
  records just after the insert.
*/

$conn = OCILogon("scott", "tiger");

$stmt = OCIParse($conn, "insert into emp (empno, ename) " .
                        
"values (:empno,:ename) " .
                        
"returning ROWID into :rid");

$data = array(1111 => "Larry", 2222 => "Bill", 3333 => "Jim");

$rowid = OCINewDescriptor($conn, OCI_D_ROWID);

OCIBindByName($stmt, ":empno", $empno, 32);
OCIBindByName($stmt, ":ename", $ename, 32);
OCIBindByName($stmt, ":rid", $rowid, -1, OCI_B_ROWID);

$update = OCIParse($conn, "update emp set sal = :sal where ROWID = :rid");
OCIBindByName($update, ":rid", $rowid, -1, OCI_B_ROWID);
OCIBindByName($update, ":sal", $sal, 32);

$sal = 10000;

while (list(
$empno, $ename) = each($data)) {
    
OCIExecute($stmt);
    
OCIExecute($update);
}

$rowid->free();

OCIFreeStatement($update);
OCIFreeStatement($stmt);

$stmt = OCIParse($conn, "select * from emp where empno in (1111,2222,3333)");
OCIExecute($stmt);
while (
OCIFetchInto($stmt, &$arr, OCI_ASSOC)) {
    
var_dump($arr);
}
OCIFreeStatement($stmt);

/* delete our "junk" from the emp table.... */
$stmt = OCIParse($conn, "delete from emp where empno in (1111,2222,3333)");
OCIExecute($stmt);
OCIFreeStatement($stmt);

OCILogoff($conn);
?>