Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

ORA-12704 character set mismatch

Oracle Database Tips by Donald BurlesonMay 5, 2016

Question: What causes the ORA-12704 error?  I am doing a SQL UNION ALL query:

ORA-12704 character set mismatch

What is the fix for the ORA-12704 error?

Answer:  The oerr utility shows this for the ORA-12704 error:

ORA-12704 character set mismatch

Cause: One of the following:

  •  The string operands (other than an NLSPARAMS argument) to an operator or built-in function do not have the same character set.

  • An NLSPARAMS operand is not in the database character set.

  • String data with character set other than the database character set is passed to a built-in function not expecting it.

  • The second argument to CHR() or CSCONVERT() is not CHAR_CS or NCHAR_CS.

  • A string expression in the VALUES clause of an INSERT statement, or the SET clause of an UPDATE statement, does not have the same character set as the column into which the value would be inserted.

  • A value provided in a DEFAULT clause when creating a table does not have the same character set as declared for the column.

  • An argument to a PL/SQL function does not conform to the character set requirements of the corresponding parameter.

Action: Strings declared with NCHAR or NCHAR VARYING do not interoperate with strings declared with CHAR or VARCHAR2. Use TRANSLATE() function to explicitly convert one to the other.

As we see, the ORA-12704 error can have many fixes and solutions.  This little demonstration shows the ORA-12704 error:

SQL> create table tbl1(x varchar2(10));

Table created.

SQL> create table tbl2(x nvarchar2(10));

Table created.

SQL> select * from tbl1 union all select * from tbl2;
select * from tbl1 union all select * from tbl2
       *
ERROR at line 1:

ORA-12704: character set mismatch

here we see how a CAST operator can fix an ORA-12704 error:

SQL> select test from mytest union select '' from mytest;
select test from mytest union select '' from mytest
       *
ERROR at line 1:
ORA-12704: character set mismatch


SQL> select test from mytest union select cast('' as nvarchar2(100)) from mytest;

TEST

Here wee see how a UNION all character set mismatch was solved with a "translate" command:

select a.product from my_product a
union all
select 'Overall' from my_product b;

Aafter I translate the column 'Overall' into nchar_cs, the problem is fixed,

select a.product from my_product a
union all
select translate ('Overall' using nchar_cs) product from my_product b;


   
Oracle Training from Don Burleson 

The best on site "Oracle training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

Oracle training
 
 


  Oracle consulting and training

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster