I did not test well before posting previous code. This if statement works and the other does not.
if( ocicolumnscale($R, $i ) != 129 )
{
$int_decimal = ocicolumnscale($R, $i );
$int_length = ocicolumnprecision($R, $i) - $int_decimal;
}
oci_field_precision
(PHP 5, PECL oci8 >= 1.1.0)
oci_field_precision — Lit la précision d'un champ Oracle
Description
Retourne la précision du champ field .
Pour les colonnes de type FLOAT, la précision et non nulle, et l'échelle est de -127. Si la précision est 0, alors la colonne est de type NUMBER. Sinon, elle est de type NUMBER(precision, scale).
Liste de paramètres
- statement
-
Un identifiant de requête OCI valide.
- field
-
Peut être un index de champ (en commençant à 1) ou un nom de champ.
Valeurs de retour
Retourne la précision, sous la forme d'un entier, ou FALSE si une erreur survient.
Notes
Note: Dans les versions de PHP antérieures à la version 5.0.0, vous devez utiliser la fonction ocicolumnprecision(). Cet ancien nom est toujours utilisable : un alias a été fait vers la fonction oci_field_precision(), pour assurer la compatibilité ascendante. Toutefois, il est recommandé de ne plus l'utiliser.
Voir aussi
- oci_field_scale() - Lit l'échelle d'une colonne Oracle
- oci_field_type() - Retourne le type de données d'un champ Oracle
oci_field_precision
15-Oct-2007 12:58
11-Oct-2007 07:39
I've found that when using ocicolumnprecision or oci_field_precision it will not show you the decimal places if you are are reading from tables with decimals. You can use ocicolumnscale or oci_field_scale to find the decimal.
if( ocicolumnscale($R, $i ) > 0 )
{
$int_decimal = ocicolumnscale($R, $i );
$int_length = ocicolumnprecision($R, $i) - $int_decimal;
}
