ocicolumntype

(PHP 3>= 3.0.4, PHP 4 )

ocicolumntype -- Returns the data type of a column

Description

mixed ocicolumntype ( resource 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() example

<?php   
    $conn = OCILogon("scott", "tiger");
    $stmt = OCIParse($conn,"select * from emp");
    OCIExecute($stmt);
    print "<TABLE BORDER=\"1\">";
    print "<TR>";
    print "<TH>Name</TH>";
    print "<TH>Type</TH>";
    print "<TH>Length</TH>";
    print "</TR>";
    $ncols = OCINumCols($stmt);
    for ( $i = 1; $i <= $ncols; $i++ ) {
        $column_name  = OCIColumnName($stmt,$i);
        $column_type  = OCIColumnType($stmt,$i);
        $column_size  = OCIColumnSize($stmt,$i);
        print "<TR>";
        print "<TD>$column_name</TD>";
        print "<TD>$column_type</TD>";
        print "<TD>$column_size</TD>";
        print "</TR>";
    }
    print "</TABLE>\n"; 
    OCIFreeStatement($stmt);  
    OCILogoff($conn);   
?>

See also ocinumcols(), ocicolumnname(), and ocicolumnsize().