Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oracle 奇怪的行为,链接数据库的结果_Oracle_Toad_Dblink - Fatal编程技术网

Oracle 奇怪的行为,链接数据库的结果

Oracle 奇怪的行为,链接数据库的结果,oracle,toad,dblink,Oracle,Toad,Dblink,在Toad上运行此查询 select * from customer@linkedDb where "CustomerNumber"=1 但是,获取单行结果 select * from customer@linkedDb where "CustomerNumber"=(select 1 from dual) 仍然返回一行,但几乎每一列都为空 任何数据转换函数或到其他表的链接都会产生相同的效果。有什么想法吗 在SQL+上尝试此操作,我得到以下结果: select "Forename" fr

在Toad上运行此查询

select * from customer@linkedDb 
where "CustomerNumber"=1
但是,获取单行结果

select * from customer@linkedDb 
where "CustomerNumber"=(select 1 from dual)
仍然返回一行,但几乎每一列都为空 任何数据转换函数或到其他表的链接都会产生相同的效果。有什么想法吗

在SQL+上尝试此操作,我得到以下结果:

select "Forename" from customer@linkedDb where "CustomerNumber"=1
结果:艾米

select "Forename" from customer@linkedDb where "CustomerNumber"=(select 1 from dual)
结果:A m y


我确信这一定是字符编码的问题,但我被难住了。

问题是从nvarchar转换为varchar

Select 
 Cast("Forename" As Varchar(50))
From
 customer@linkedDb
Where
 "CustomerNumber"=(select 1 from dual)
不起作用,因为select 1 from dual似乎会导致数据自动广播。真正起作用的是铸造后对价值的任何改变——我认为这可能促使甲骨文改变事情的顺序

Select 
 Substr(Cast("Forename" As Varchar(50)),1,50)
From
 customer@linkedDb
Where
 "CustomerNumber"=(select 1 from dual)

这很有效。这是一个丑陋的-稍微昂贵的解决方案,所以我有一些解决办法-但我想如果其他人遇到同样的问题,我会发布这篇文章作为思考的食物。

如果在SQL*Plus中运行上述两个查询,会得到同样的结果吗?对不起,你是对的-这不是一个蟾蜍问题。SQL+也没有返回我需要的内容我已经更新了问题