OCIColumnSize

OCIColumnSize -- return result column size

Description

int OCIColumnSize(int stmt, mixed column);

OCIColumnSize() returns the size of the column as given by Oracle. You can either use the column-number (1-Based) or the column-name for the col parameter.

Example 1. OCIColumnSize

  1 
  2 <?php   
  3     print "<HTML><PRE>\n";   
  4     $conn = OCILogon("scott", "tiger");
  5     $stmt = OCIParse($conn,"select * from emp");
  6     OCIExecute($stmt);
  7     print "<TABLE BORDER=\"1\">";
  8     print "<TR>";
  9     print "<TH>Name</TH>";
 10     print "<TH>Type</TH>";
 11     print "<TH>Length</TH>";
 12     print "</TR>";
 13     $ncols = OCINumCols($stmt);
 14     for ( $i = 1; $i <= $ncols; $i++ ) {
 15         $column_name  = OCIColumnName($stmt,$i);
 16         $column_type  = OCIColumnType($stmt,$i);
 17         $column_size  = OCIColumnSize($stmt,$i);
 18         print "<TR>";
 19         print "<TD>$column_name</TD>";
 20         print "<TD>$column_type</TD>";
 21         print "<TD>$column_size</TD>";
 22         print "</TR>";
 23     }
 24     print "</TABLE>";
 25     OCIFreeStatement($stmt);  
 26     OCILogoff($conn);   
 27     print "</PRE>";
 28     print "</HTML>\n"; 
 29 ?>   

See also OCINumCols(), OCIColumnName(), and OCIColumnSize().