Lost precision when reading number column to C double variable via OCI
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;
--
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;
0