ORA-12704:字符集不匹配
阿新 • • 發佈:2019-01-26
在使用union all連線時,若A集合中某列為nvarchar2或nvarchar2型別,而B集合中無此列,用
''來代替或者說B集合中此列為varchar2型別,會報字符集不匹配的錯誤,
如下:
[email protected]> select cast('測試' as nvarchar2(10)) t from dual
2 union all
3 select '' from dual;
select cast('測試' as nvarchar2(10)) t from dual
*
ERROR at line 1:
ORA-12704: character set mismatch
解決方法
1.to_char()
[email protected]> select to_char(cast('測試' as nvarchar2(10))) t from dual2 union all
3 select '' from dual;