oracle當(dāng)多表union時(shí)遇到nvarchar2類(lèi)型時(shí)報(bào)錯(cuò) 字符集不匹配
對(duì)使用nvarchar的地方,加上 to_char( nvarchar 的變量或字段 )
如:
select to_char(name),price from aa
union all
select to_char(name),price from bb
3張表aa,bb,cc都有 name price 字段 查詢(xún)價(jià)格最高的前3位姓名
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
對(duì)使用nvarchar的地方,加上 to_char( nvarchar 的變量或字段 )
如:
select to_char(name),price from aa
union all
select to_char(name),price from bb
3張表aa,bb,cc都有 name price 字段 查詢(xún)價(jià)格最高的前3位姓名
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