6 07年04月

oracle 8汉字、字母混合排序

关键字:,
贝贝爸 发表在 原创技术文章 |

有时候通讯录,或者名字排名需要按照字母来分块,如下:

下载: test.txt
J  计划财务部  经理办公室  境外人士服务中心 
L 留学中心
M 门诊部
P 培训中心
Q 其它

解决方案

增加了一个表,内容如下:

下载: pinyin.txt
a 啊 f
b 芭 f
c 擦 f
d 搭 f
e 蛾 f
f 发 f
g 噶 f
h 哈 f
i f
j 击 f
k 喀 f
l 垃 f
m 妈 f
n 嗯 f
o 哦 f
p 啪 f
q 期 f
r 然 f
s 撒 f
t 塌 f
u f
v f
w 挖 f
x 昔 f
y 压 f
z 匝 f

上述表的作用主要是和参与整个内容的排序,如果发现这个表里的数据,那么就做相应的处理。
i,u,v为空是因为没有汉字是这些拼音开始的。sql如下

select *
 
from (select *
          
from (select b.dept_id, b.name, count(*) c
                  
from test.t_oper_info a, test.t_dept_info b
                
where a.dept_id = b.dept_id
                
group by b.dept_id, b.name
                
having count(*) > 0
                
order by b.name)
        
union
        
select upper(pinyin) dept_id, hz name, 0 c from test.t_pinyinorder) a
 
where a.name is not null
 
order by a.name

相关文章

发表评论

美体小铺急救棒 the bodyshop body shop 美体小铺茶树精油 美体小铺接骨木花眼胶 美体小铺VE眼霜
16Q.0.614Ss.