sql 中的 2 列依次向下
2 columns one below another in sql
select cap2 as captain from data group by cap2
union all
select cap3 as captain from data group by cap3
我遇到了这个错误
ORA-12704: character set mismatch
你能帮我解决这个问题吗
看看这是否有帮助。
我推测你的情况是这样的:
SQL> create table test
2 (cap2 varchar2(10),
3 cap3 nvarchar2(10));
Table created.
SQL> insert into test values ('A', 'B');
1 row created.
这是您当前的查询:
SQL> select cap2 from test
2 union
3 select cap3 from test;
select cap2 from test
*
ERROR at line 1:
ORA-12704: character set mismatch
您可能会尝试这样做 - 将 to_char
函数应用于 nvarchar2
列:
SQL> select cap2 from test
2 union
3 select to_char(cap3) from test;
CAP2
----------------------------------------
A
B
SQL>
select cap2 as captain from data group by cap2
union all
select cap3 as captain from data group by cap3
我遇到了这个错误
ORA-12704: character set mismatch
你能帮我解决这个问题吗
看看这是否有帮助。
我推测你的情况是这样的:
SQL> create table test
2 (cap2 varchar2(10),
3 cap3 nvarchar2(10));
Table created.
SQL> insert into test values ('A', 'B');
1 row created.
这是您当前的查询:
SQL> select cap2 from test
2 union
3 select cap3 from test;
select cap2 from test
*
ERROR at line 1:
ORA-12704: character set mismatch
您可能会尝试这样做 - 将 to_char
函数应用于 nvarchar2
列:
SQL> select cap2 from test
2 union
3 select to_char(cap3) from test;
CAP2
----------------------------------------
A
B
SQL>