[Orclib-users] Direct Path with NUMBER (10,2)
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
|
From: Johannsmeier, D. (K-SIPV-4/6) <die...@vo...> - 2015-11-20 10:34:00
|
Hello everybody,
I am new to OCILIB (4.2.0 on Linux) and I try to extend and run the example ocilib_demo.c
I want to test a NUMBER(10,2) column.
So I extend the test table and add some code to the test program:
OCI_DirPathSetColumn(dp,1,"VAL_INT", SIZE_COL1,NULL);
OCI_DirPathSetColumn(dp,2,"VAL_STR", SIZE_COL2,NULL);
OCI_DirPathSetColumn(dp,3,"VAL_DATE", SIZE_COL3,"YYYYMMDD");
OCI_DirPathSetColumn(dp,4,"VAL_FLOAT", SIZE_COL4,NUMFORM); <- new e.g. #define NUMFORM "%f"
And:
sprintf(val1, "%4d",i + (i*100));
sprintf(val2, "value %05d",j + (i*100));
sprintf(val3, "%04d%02d%02d",(j%23)+1+2000, (j%11)+1, (j%23)+1);
sprintf(val4, "%4.2f",1.01); <-new
OCI_DirPathSetEntry(dp,j,1,val1,(unsigned int) strlen(val1),TRUE);
OCI_DirPathSetEntry(dp,j,2,val2,(unsigned int) strlen(val2),TRUE);
OCI_DirPathSetEntry(dp,j,3,val3,(unsigned int) strlen(val3),TRUE);
OCI_DirPathSetEntry(dp,j,4,val4,(unsigned int) strlen(val4),TRUE); <- new
I try a lot of different things but the column in the database is always NULL. With the help of a debugger I see that
the function OCI_NumberToString doesn't return something in its output (out_value, out_value_size)
What's wrong?
Thank you in advance
Dieter Johannsmeier
|