我想在SQL Developer的查询结果面板中显示Unicode字符。
杰夫史密斯的Non-English Character Display in Oracle SQL Developer帖子表明,这只是选择正确字体的问题。我选择consolas
:
此设置似乎在工作表中有效:
但不在结果中:
所需:
ORDER_NAME MIN_ORDER_DATE MAX_ORDER_DATE SPARKLINE
ORDER A 2016-12-01 2017-03-02 ⣀⣴⣀⣀
ORDER B 2017-03-01 2017-03-01 ⣾
代码段:
with
orders as (
select order_name, order_id, to_date(ORDER_date,'mm/dd/yy') order_date
,extract(year from to_date(ORDER_date,'mm/dd/yy')) year, extract(month from to_date(ORDER_date,'mm/dd/yy')) month
from (
select 'ORDER A' order_name, 1 order_id, '12/01/16' ORDER_date FROM DUAL
union ALL
select 'ORDER A' order_name, 2 order_id, '01/02/17' ORDER_date FROM DUAL
union ALL
select 'ORDER A' order_name, 3 order_id, '01/03/17' ORDER_date FROM DUAL
union ALL
select 'ORDER A' order_name, 4 order_id, '01/01/17' ORDER_date FROM DUAL
union ALL
select 'ORDER A' order_name, 5 order_id, '02/02/17' ORDER_date FROM DUAL
union ALL
select 'ORDER A' order_name, 6 order_id, '03/02/17' ORDER_date FROM DUAL
union ALL
select 'ORDER B' order_name, 7 order_id, '03/01/17' ORDER_date FROM DUAL
) v
)
select
order_name
, min(min_order_date) min_order_date, max(max_order_date) max_order_date
,listagg(
case
when percent_total=0 then '⠀'
when percent_total < 1/8 then '⡀'
when percent_total < 2/8 then '⣀'
when percent_total < 3/8 then '⣠'
when percent_total < 4/8 then '⣤'
when percent_total < 5/8 then '⣴'
when percent_total < 6/8 then '⣶'
when percent_total < 7/8 then '⣾'
else '⣿'
end,'') within group (order by year, month) SPARKLINE
FROM (
SELECT order_name, year, month, min_order_date, max_order_date
, monthly_orders, sum(monthly_orders) over (PARTITION BY order_name) total_orders
,monthly_orders / sum(monthly_orders) over (PARTITION BY order_name) percent_total
FROM (
SELECT order_name, year, month, count(order_id) monthly_orders, min(order_date) min_order_date, max(order_date) max_order_date
FROM orders o
group by order_name, year, month
) v0
) v1
group by order_name
order by order_name
我错过了什么?
我在OS X Sierra上使用SQL Developer 4.1.3.20(10.12.6)。
我尝试了许多不同的字体,这些字体似乎在“首选项”中有效,但对查询结果窗格没有影响:
$ java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
C:\> java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) Client VM (build 25.101-b13, mixed mode, sharing)
select * from v$nls_parameters
PARAMETER VALUE
NLS_CHARACTERSET WE8ISO8859P1
NLS_NCHAR_CHARACTERSET AL16UTF16