Precompilers and OCI (MOSC)

MOSC Banner

Lost precision when reading number column to C double variable via OCI

edited Feb 16, 2010 4:32PM in Precompilers and OCI (MOSC) 5 commentsAnswered
Precision of a number column greater then 5 is lost when read via OCI program to a double variable. The test program below shows the problem. I have checked this on Oracle 10.2 & 11.1/ Windows, 10.1 on Linux. The sample program output is:
--
Value inserted: 1234567890.123456
Read value:     1234567890.123460
--
With regards,
Bozena Potempa

Below the test program code:
-- Begin ---
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <oci.h>

#define NO_ERROR 0
#define ORACLE_ERROR 1


OCIEnv     *envp;
OCIServer  *srvp;
OCISession *sesp;
OCISvcCtx  *svcp;
OCIError   *errp;
OCIStmt    *cda;
char textb[1000];

void ora_error( dvoid *php, sword pres )
{
    sb4 err_code = 0;
    sword n;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center