PHP Manual
Prev |  | Next

# OCIColumnType

OCIColumnType -- Returns the data type of a column.

## Description

`mixed OCIColumnName`(int stmt, int col);

OCIColumnType() returns the data type of the column corresponding to the column number (1-based) that is passed in.

Example 1. OCIColumnType

      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     OCIFreeStatement($stmt);
     25     OCILogoff($conn);
     26     print "</PRE>";
     27     print "</HTML>\n";
     28 ?>

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

Prev | Home | Next
OCIColumnName | Up | OCIParse