通过oracle的NLSSORT函数对汉字按照拼音排序,然后根据汉字的区间返回对应的首字母. 效果1,获取拼音简码: 效果2,获取姓名首字母: 创建函数: /* 获取拼音简码函数 */ CREATE OR REPLACE FUNCTION GET_PYJM (P_NAME IN VARCHAR2) RETURN VARCHAR2 AS V_COMPARE ); V_RETURN ); BEGIN DECLARE FUNCTION F_NLSSORT (P_WORD IN VARCHAR2) RE
//获取 汉字首字母 function makePy(str) { if (typeof (str) != "string") throw new Error(-1, "函数makePy需要字符串类型参数!"); var arrResult = new Array(); for (var i = 0, len = str.length; i < len; i++) { var ch = str.charAt(i); arrResult.push(checkCh
有一个person对象如下: public class Person { private String id;private String nam; } 一个list集合如下: List<Employee> personList= Arrays.asList( new Person("1",“张小同"), new Person("2",”靖大同"), new Person("3",”王五"), new P
--创建取汉字首字母函数(第三版) create function [dbo].[f_getpy_V3] ( ) ) ) as begin ),) ,@len = len(@col),@sql = '' while @cyc <= @len begin ) as varbinary) ),ecode ),letter )) insert into @maco select 0XB0A1,0XB0C4,'A' union all select 0XB0C5,0XB2C0,'B' union all
select * FROM organ_new where city_code = 'SZ0755' and organ_type = 'H' and state = '1' ORDER BY FIELD(organ_category,'三级','二级','一级') ,#自定义排序 CONVERT(organ_name USING gbk) COLLATE #中文首字母排序 gbk_chinese_ci DESC