- 论坛徽章:
- 0
|
我现在要把一组char类型数据插入到数据库中,假设如下
- struct a
- {
- int iTestInt;
- long lTestLong;
- unsigned char cTestChar;
- char strTestStr[20];
- }
复制代码
将这个结构体插入到数据库中,其中缓存设置如下
类型 长度
iTestInt : SQLT_INT sizeof(int)
iTestLong: SQLT_INT sizeof(long)
cTestChar: SQLT_UIN sizeof(int)
strTestStr: SQLT_STR (20+2)*sizeof(char)
然后使用将把 struct a中的各个字段用 memcpy(pBuf, &a.iTestInt,sizeof(a.iTest)) 的方式进行赋值。
在 OCIBindByPos(),然后 OCIStmtExecute()的时候,就会出现这个错误:
ORA-01438: value larger than specified precision allows for this column
如果不对缓冲空间赋值的话,就可以成功执行OCIStmtExecute。
请大家帮忙,怎么实现精度控制啊? |
|