ocicolumntype

(PHP 3>= 3.0.4, PHP 4 , PHP 5)

ocicolumntype -- Retourne le type de données d'une colonne Oracle

Description

mixed ocicolumntype ( resource stmt, int col )

ocicolumntype() retourne le type de données de la colonne correspondant au numéro de colonne col dans le résultat stmt (les colonnes sont indexées à partir de 1).

Exemple 1. Exemple avec ocicolumntype()

<?php   
echo "<html><pre>\n";   
$conn = OCILogon("scott", "tiger");
$stmt = OCIParse($conn,"select * from emp");
OCIExecute($stmt);
echo
'<table>';
echo
'<tr>';
echo
'<th>Nom</th>';
echo
'<th>Type</th>';
echo
'<th>Longueur</th>';
echo
'</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);
  echo
'<tr>';
  echo
'<td>' . $column_name . '</td>';
  echo
'<td>' . $column_type . '</td>';
  echo
'<td>' . $column_size . '</td>';
  echo
'</tr>';
}
echo
"</table>\n";
OCIFreeStatement($stmt);  
OCILogoff($conn);   
echo
'</pre>';
echo
"</html>\n";
?>

Note : Cette fonction a été renommée en oci_field_type() pour PHP version 5.0.0 et plus récent. Pour la compatibilité ascendante, ocicolumntype() peut toujours être utilisée. Toutefois, elle est obsolète.