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 — フィールドの精度を問い合わせる
説明
int oci_field_precision
( resource $statement
, int $field
)
field の精度を返します。
FLOAT 型カラムの精度は 0 でなく桁数は -127 となります。 もし精度が 0 の場合、カラムは NUMBER 型、そうでなければ NUMBER(精度, 桁数) となります。
パラメータ
- statement
-
有効な OCI ステートメント ID。
- field
-
フィールド番号 (1 から始まる) あるいは名前のいずれか。
返り値
精度を表す整数値、あるいはエラー時に FALSE を返します。
注意
注意: PHP バージョン 5.0.0 以前では、代わりに ocicolumnprecision() を使用しなければなりません。 まだこの名前を使用することができ、下位互換性のため oci_field_precision() への別名として残されていますが、 推奨されません。
oci_field_precision
webmaster at smwebdesigns dot com
15-Oct-2007 12:58
15-Oct-2007 12:58
webmaster at smwebdesigns dot com
11-Oct-2007 07:39
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;
}
