oracle如何获取房子首字母,如果里面包括数字、字母、字符的要求保留。
例如:输入:辽宁省-123*ABC
输出:LNS-123*ABC
oracle获取汉字首字母
答案:3 悬赏:30 手机版
解决时间 2021-03-17 04:30
- 提问者网友:兔牙战士
- 2021-03-16 14:50
最佳答案
- 五星知识达人网友:一秋
- 2021-03-16 15:10
这个就靠Oracle是做不到的吧?
有个方法:
1)你用Windows 2000/XP自带的输入法生成器,可以得到一个 拼音汉字的对应关系文本文件
2)将上一步的文本文件处理后导入oracle的表
3)然后就好办了。
有个方法:
1)你用Windows 2000/XP自带的输入法生成器,可以得到一个 拼音汉字的对应关系文本文件
2)将上一步的文本文件处理后导入oracle的表
3)然后就好办了。
全部回答
- 1楼网友:几近狂妄
- 2021-03-16 17:00
create or replace function f_pinyin(p_name in varchar2) return varchar2 as
v_compare varchar2(100);
v_return varchar2(4000);
function f_nlssort(p_word in varchar2) return varchar2 as
begin
return nlssort(p_word, 'nls_sort=schinese_pinyin_m');
end;
begin
for i in 1..nvl(length(p_name), 0) loop
v_compare := f_nlssort(substr(p_name, i, 1));
if v_compare >= f_nlssort('吖') and v_compare <= f_nlssort('骜') then
v_return := v_return || 'a';
elsif v_compare >= f_nlssort('八') and v_compare <= f_nlssort('簿') then
v_return := v_return || 'b';
elsif v_compare >= f_nlssort('嚓') and v_compare <= f_nlssort('错') then
v_return := v_return || 'c';
elsif v_compare >= f_nlssort('咑') and v_compare <= f_nlssort('鵽') then
v_return := v_return || 'd';
elsif v_compare >= f_nlssort('妸') and v_compare <= f_nlssort('樲') then
v_return := v_return || 'e';
elsif v_compare >= f_nlssort('发') and v_compare <= f_nlssort('猤') then
v_return := v_return || 'f';
elsif v_compare >= f_nlssort('旮') and v_compare <= f_nlssort('腂') then
v_return := v_return || 'g';
elsif v_compare >= f_nlssort('妎') and v_compare <= f_nlssort('夻') then
v_return := v_return || 'h';
elsif v_compare >= f_nlssort('丌') and v_compare <= f_nlssort('攈') then
v_return := v_return || 'j';
elsif v_compare >= f_nlssort('咔') and v_compare <= f_nlssort('穒') then
v_return := v_return || 'k';
elsif v_compare >= f_nlssort('垃') and v_compare <= f_nlssort('擽') then
v_return := v_return || 'l';
elsif v_compare >= f_nlssort('呒') and v_compare <= f_nlssort('椧') then
v_return := v_return || 'm';
elsif v_compare >= f_nlssort('拏') and v_compare <= f_nlssort('疟') then
v_return := v_return || 'n';
elsif v_compare >= f_nlssort('筽') and v_compare <= f_nlssort('沤') then
v_return := v_return || 'o';
elsif v_compare >= f_nlssort('妑') and v_compare <= f_nlssort('曝') then
v_return := v_return || 'p';
elsif v_compare >= f_nlssort('七') and v_compare <= f_nlssort('裠') then
v_return := v_return || 'q';
elsif v_compare >= f_nlssort('亽') and v_compare <= f_nlssort('鶸') then
v_return := v_return || 'r';
elsif v_compare >= f_nlssort('仨') and v_compare <= f_nlssort('蜶') then
v_return := v_return || 's';
elsif v_compare >= f_nlssort('侤') and v_compare <= f_nlssort('箨') then
v_return := v_return || 't';
elsif v_compare >= f_nlssort('屲') and v_compare <= f_nlssort('鹜') then
v_return := v_return || 'w';
elsif v_compare >= f_nlssort('夕') and v_compare <= f_nlssort('鑂') then
v_return := v_return || 'x';
elsif v_compare >= f_nlssort('丫') and v_compare <= f_nlssort('韵') then
v_return := v_return || 'y';
elsif v_compare >= f_nlssort('帀') and v_compare <= f_nlssort('咗') then
v_return := v_return || 'z';
end if;
end loop;
return v_return;
end;
- 2楼网友:忘川信使
- 2021-03-16 16:30
这个得要知道字符集才行,你是单字节字符集还是双字节字符集
汉字是可以比较大小的,你找到声母的边界汉字,再一比较就行了,关键是这个边界汉字
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯