Oracle encounters NVARCHAR2 type times wrong character set mismatch when multi-table union
For places where nvarchar is used, add to_char (nvarchar variable or field)
Such as:
Select To_char (name), Price from AA
UNION ALL
Select To_char (name), Price from BB
3 table AA,BB,CC have the name Price field to query the top 3 most expensive names
SELECT * FROM (select TO_CHAR (name), Price from AA
UNION ALL
Select To_char (name), Price from BB
UNION ALL
Select To_char (name), Price from CC ORDER BY price DESC) where rownum<=3
Note
VARCHAR2 is a specific data type provided by Oracle, and Oracle can guarantee that the data type is up and backwards compatible in any version of VARCHAR2.
VarChar is not recommended for use in Oracle.
Specific to the difference between NVARCHAR2 and VARCHAR2, from the point of view of the difference is: NVARCHAR2 in the calculation of length and character sets, such as the database is the Chinese character set with length 10 for example, then
1, NVARCHAR2 (10) is can be stored in 10 Chinese characters, if used to save English can only save 10 characters.
2, and VARCHAR2 (10), then only 5 characters can be stored in English, 10.
Nvarchar2 character set mismatch in Oracle