OCINumCols

OCINumCols -- Return the number of result columns in a statement

Description

int OCINumCols(int stmt);

OCINumCols() returns the number of columns in a statement

Example 1. OCINumCols

  1 
  2 <?php   
  3     print "<HTML><PRE>\n";   
  4     $conn = OCILogon("scott", "tiger");
  5     $stmt = OCIParse($conn,"select * from emp");
  6     OCIExecute($stmt);
  7     while ( OCIFetch($stmt) ) {
  8         print "\n";   
  9         $ncols = OCINumCols($stmt);
 10         for ( $i = 1; $i <= $ncols; $i++ ) {
 11             $column_name  = OCIColumnName($stmt,$i);
 12             $column_value = OCIResult($stmt,$i);
 13             print $column_name . ': ' . $column_value . "\n";
 14         }
 15         print "\n";
 16     }
 17     OCIFreeStatement($stmt);  
 18     OCILogoff($conn);   
 19     print "</PRE>";
 20     print "</HTML>\n"; 
 21 ?>