ORA-01460:要求未实现或不合理的转换 [英] ORA-01460: unimplemented or unreasonable conversion requested

查看:134
本文介绍了ORA-01460:要求未实现或不合理的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行以下.Net代码时:

When I run the following .Net code:

using (var c = Shared.DataSources.BSS1.CreateCommand())
{
    c.CommandText = "\r\nSelect c1, c2, c3, rowid \r\nFrom someSpecificTable \r\nWhere c3 = :p0";
    var p = c.CreateParameter() as Oracle.DataAccess.Client.OracleParameter;
    c.Parameters.Add(p);
    p.OracleDbType = Oracle.DataAccess.Client.OracleDbType.Varchar2;
    p.DbType = System.Data.DbType.AnsiString;
    p.Size = 20;
    p.Value = "007";
    p.ParameterName = ":p0";
    using (var r = c.ExecuteReader())
    {
        r.Read();
    }
}

我收到以下错误:

ORA-01460: unimplemented or unreasonable conversion requested
ORA-02063: preceding line from XXX

这不是我的数据库,并且我无法控制从数据库链接获得的表的选择语句.

This is not my database, and I don't have control over the select statements that I get, that table IS from a database link.

有趣的是,如果我在ExecuteReader之前添加以下代码,它将运行正常.

The funny thing is that if I add the following code just before the ExecuteReader it runs fine.

c.CommandText = c.CommandText.Replace("\r\n", " ");

不幸的是,在我的情况下,这不是一个好的解决方案,因为我无法控制SQL,所以我不能那样修改它.

Unfortunately that is not a good solution in my case as I can't control to SQL nore can I change it that way.

对于表本身,列为: c1编号(5) c2 varchar2(40) c3 varchar2(20).

As for the table itself, the columns are: c1 Number(5) c2 varchar2(40) c3 varchar2(20).

我知道后面的ORA-02063表示有关数据库链接的某些信息,但是我查看了synonim表,它不是来自任何database_link,而且我也不认为\ r \ n应该会影响数据库链接.

I know that ORA-02063 that comes after indicate something about a database link, but I looked in the synonim table and it didn't come from any database_link, and also I don't think that \r\n should affect database link.

我尝试在没有绑定参数的情况下运行查询,并且确实奏效了-但总的来说,这样做也是错误的做法.

I tried running the query without bound parameters, and it did work - but again bad practice to do so in a general term.

问题在于,不是基于.Net的竞争工具正在运行,因此这不是普遍问题.

The trouble is that a competing tool that is not .Net based, is working and thus it's not a general problem.

我也无法在自己的环境中重现该问题,这是客户数据库和站点. 我正在使用即时客户端11.1.6.20,并且还在即时客户端11.2.3.0中对其进行了测试

I also couldn't reproduce the problem in my own environment, this is a customer database and site. I am using instant client 11.1.6.20 and also tested it with instant client 11.2.3.0

数据库为10,并且数据库链接为oracle v8数据库

The db is 10 and the db link is to an oracle v8 database

任何帮助将不胜感激

推荐答案

最后我找到了答案!

在研究并反映了代码之后,我发现通过将参数的方向"更改为输入输出,问题得以解决.

After investigating and reflecting into the code I found that by changing the Direction of the Parameter to input output - the problem was resolved.

p.Direction = ParameterDirection.InputOutput;

这篇关于ORA-01460:要求未实现或不合理的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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