ora-01406使用OCI提取值时出错 [英] ora-01406 Error when fetching values using OCI

查看:168
本文介绍了ora-01406使用OCI提取值时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当将最大长度为50的值提取到只能容纳30个字符的缓冲区时,就会发生这种情况.

This occurs when fetching values which have a max length of 50, to a buffer which could only hold 30 chars.

我已经查找了错误,并找到了一种可能的解决方案,那就是扩大该值绑定到的缓冲区的大小.

I've already looked up the error and found a possible solution, which is to expand the size of the buffer which the value is bound to.

问题是,这仅在我们的某些系统中发生,而在其他系统中则没有. Oracle版本与此有关吗?如果是这样,此错误已更改为什么版本?

The problem is, this occurs only in some of our systems and not in others. Does the Oracle version have anything to do with this? If so, what is the version in which this error has been changed?

我们使用的Oracle版本是10.2.0.1和10.2.0.3

The Oracle versions we use are 10.2.0.1 and 10.2.0.3

推荐答案

问题中列出的错误已在10.2.0.3中修复,并且该错误仅在此之前的Oracle版本中给出. 在Oracle 10.2.0.4中看到了相同的问题.我们仍在寻找这个

The bug listed in the question has been fixed in 10.2.0.3 and The error is only given in Oracle versions prior to that. The same issue was seen in Oracle 10.2.0.4. We're still looking in to this

Edit2:在OCI中为CHAR/VARCHAR列定义游标时(为此我们使用包装器),绑定到列的字符串的大小必须至少比列的最大宽度大1.

When defining cursors for CHAR/VARCHAR columns in OCI (we use a wrapper for this purpose), the size of the string which is bound to a column must be at least one greater than the maximum width of the column.

例如列名称:U_NAME类型:VARCHAR(30)

e.g. Column Name: U_NAME Type: VARCHAR(30)

1. char zName [30]; pCursor-> Define(zName,3O); //如果该列的值包含30个字符,则会崩溃

1. char zName[30]; pCursor->Define(zName, 3O); // this would crash if the column has a value with 30 chars

2. char zName [31]; pCursor-> Define(zName,3O); //如果该列的值包含30个字符,则会崩溃

2. char zName[31]; pCursor->Define(zName, 3O); // this would crash if the column has a value with 30 chars

3. char zName [31]; pCursor-> Define(zName,31); //正确的.不会因为任何值而崩溃

3. char zName[31]; pCursor->Define(zName, 31); // Correct. would not crash for any value

这篇关于ora-01406使用OCI提取值时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆