|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2002-06-21 14:20 UTC] ThorpeJ at gao dot gov
 I've tried using OCIColumnIsNULL() to retrieve info on which fields were NULL/NOT NULL in an Oracle database table, and the function did not return anything (using OCIColumnName, OCIColumnType, and OCIColumnSize in the same program worked fine). The script below is a simple example:
/******************************************************/
$conn = OCILogon($user, $pwd, $db);
$stmt = OCIParse($conn, "select * from $table");
OCIExecute($stmt);
$ncols = OCINumCols($stmt);
for ( $i = 1; $i <= $ncols; $i++ ) {
  echo "NAME: " . OCIColumnName($stmt,$i) . "<BR>";
  echo "TYPE: " . OCIColumnType($stmt,$i) . "<BR>";
  echo "SIZE: " . OCIColumnSize($stmt,$i) . "<BR>";
  echo "ISNULL: " . OCIColumnIsNULL($stmt,$i) . "<P>"; //Function does not return any information
}
/******************************************************/
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 15:00:01 2025 UTC | 
true, actually, what i noticed is that if you do a fetch *before* calling OCIColumnIsNULL() you then get the right results. /******************************************************/ $conn = OCILogon($user, $pwd, $db); $stmt = OCIParse($conn, "select * from $table"); OCIExecute($stmt); $nrows = OCIFetchStatement($stmt, $res); // adding this $ncols = OCINumCols($stmt); for ( $i = 1; $i <= $ncols; $i++ ) { echo "NAME: " . OCIColumnName($stmt,$i) . "<BR>"; echo "TYPE: " . OCIColumnType($stmt,$i) . "<BR>"; echo "SIZE: " . OCIColumnSize($stmt,$i) . "<BR>"; echo "ISNULL: " . OCIColumnIsNULL($stmt,$i) . "<P>"; //Function does not return any information } /******************************************************/ Will go to fix that.