问题描述
我有一个SQL Server数据库,该数据库的表的数据类型为nvarchar(4000)
列.当我尝试通过dblink从Oracle读取数据时,没有看到nvarchar(4000)
列.其他所有列的数据均正确显示.
I have a SQL Server database with a table that has a column of nvarchar(4000)
data type. When I try to read the data from Oracle through a dblink, I don't see the nvarchar(4000)
column. All the other column's data is displayed properly.
有人可以帮我在这里找到问题以及如何解决吗?
Can anyone help me to find the issue here and how to fix it?
推荐答案
ODBC Oracle注释
ODBC Oracle Comment
SQL_WCHAR NCHAR-
SQL_WVARCHAR
NVARCHAR-如果Oracle DB字符集= Unicode,则为SQL_WLONGVARCHAR LONG. 否则,不支持
SQL_WCHAR NCHAR -
SQL_WVARCHAR
NVARCHAR - SQL_WLONGVARCHAR LONG if Oracle DB Character Set = Unicode. Otherwise, it is not supported
Common nvarchar(max)
映射到SQL_WLONGVARCHAR
,并且只有Oracle数据库字符集为unicode
时,此数据类型才可以映射到Oracle.
Commonly nvarchar(max)
is mapped to SQL_WLONGVARCHAR
and this data type can only be mapped to Oracle if the Oracle database character set is unicode
.
要检查数据库字符集,请排除:
To check the database character set, please excuet:
select * from nls_parameters;
看看:NLS_CHARACTERSET
更新
NLS_CHARACTERSET
必须是一个unicode
字符集-例如AL32UTF8
(如果您知道自己在做什么,或者要求DBA这样做,请执行此操作.)
NLS_CHARACTERSET
needs to be a unicode
character set - for example AL32UTF8
(Do this if you know what you are doing or ask you r DBA to do it.)
NCHAR
字符集,因为映射到使用常规数据库字符集的Oracle LONG
.
NCHAR
character set isn't used as the mapping is to Oracle LONG
which uses the normal database character set.
第二种解决方案是在SQL Server端创建一个将nvarchar(max)
拆分为多个nvarchar(xxx)
的视图,然后从该视图中进行选择,然后再次在Oracle中合并内容.将字符集更改为unicode,那么这种方法就可以使用.)
A 2nd solution would be to create on the SQL Server side a view that splits the nvarchar(max)
to several nvarchar(xxx)
and then to select from the view and to concatenate the content again in Oracle.(If you have problem with changing the character set to unicode then this approach is the beset way to go.)
这篇关于从Oracle读取SQL Server数据库表时缺少nvarchar列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!