PostgreSQL汉字转拼音首字母

PostgreSQL汉字转拼音首字母,最近有个需求要做搜索优化,要求提取汉字首字母识别输入,图方便直接数据库用函数批量转换了,整理了网上的两个方法函数备忘,非原创。

https://blog.qdac.cc/?p=1281
https://developer.aliyun.com/article/228252

题外话,Java方案可以引入pinyin4j直接使用蛮方便,hutool也封装了拼音解决方案,通过SPI机制引入具体实现,maven坐标如下:

https://pinyin4j.sourceforge.net/

<dependency>
    <groupId>cn.hutoolgroupId>
    <artifactId>hutool-allartifactId>
    <version>5.8.15version>
dependency>


<dependency>
    <groupId>com.belerwebgroupId>
    <artifactId>pinyin4jartifactId>
    <version>2.5.1version>
dependency>

演示效果

SELECT pinyin_first_cap('hello WORLD,你好,世界,@饕餮1996');

HELLOWORLDNHSJTT1996

SELECT pinyin_first_char('hello WORLD,你好,世界,@饕餮1996');

HELLO WORLD,NH,SJ,@饕餮1996

方案1(字符集全,推荐)

CREATE OR REPLACE FUNCTION "public"."bytea_to_int"("data" bytea)
  RETURNS "pg_catalog"."int4" AS $BODY$
declare
    nLen int;
    i int;
    v int = 0;
    t int = 0;
begin
    nLen = length(data);
    for i in 0..nLen-1 loop
        t = get_byte(data,i);
        t = t * power(256,(nLen-1-i));

        v = v + t;
    end loop;
    return v;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
CREATE OR REPLACE FUNCTION "public"."pinyin_first_cap"("v_str" varchar)
  RETURNS "pg_catalog"."varchar" AS $BODY$
DECLARE
  pos        INT4;
  hzlen      INT4;
  hz         VARCHAR (10);
  hzbm       INT4;
  hzpy       VARCHAR (10);
  py         VARCHAR (4000);
  hasspace   INT4;
	-- 相比pinyin_first_char()字符集要全,推荐使用
	-- hz 汉字;

	-- 下方不是乱码,是汉字编码首拼音对照表,不要删改任何字符,每个编码区3500个字符。
   hzpybm_0   CONSTANT VARCHAR (3500) = '                                                                                                                                                                                                                                                                                                                                KSXMMCSDQLYBJJJGCZBJFYYSJHYHCHZGJHHDSNKKTMOCXYPSNQSECCZGQLLYJMS YSSGYQYDYXJYYDLDWJJWBBFJEXTHGBCCCRFCQWYFCWDZPYDDWYXJAJPDFTCYCQXXCXNNXXZQBPZSYZHMZBQBZCYZBXQSBHHXGFMBHHGQCXSTGLYGYMXALELCCXZRCSD                                                                 TNJJCZZHLJSTSTBNXTYXXGKWYFLHJQSPXFXXDCZLSHXJBCFYBYXHCZBJYCLWLCZ GTSMTCXPQGLSJFZZLSLHDZBWJNCJYSNYCQRZCWYBTYFTWECSKDCBXHYZCYYXZCFBZMJYXXCDCZTBZJWSZSXYRNYJMDTHJXSQJCCSBXRYTSYFBJZGCLYZZPSCYZQSCJH                                                                 ZQYDXLBPJLLMQXTYDZSQJTZPLCGQDCWJBHCTDJFXYELBGXXMYJJQFZASYJNCYDK JCJSZCBATCCLNJQMWNQNCLLKBYBZZSYHQCLTWLCCRSHLLZNTYLNZXDDTCEEJYSSQGHSDBGHWNLYHTPJYMRYMCJGJMZGXYKYSSMZKLFXMTGYPFMQJSMTGJQDGYALCMZC                                                                 SDJLXDFFJCZFMNFFKGPKHRCJQCJDWJLFQDMLZBJJSCGCKDEJCJDLZYCKCCCLFCQ CZGBDQDJJYHDZWGSJDKCCCTLLPSKGHZZLJLGJGJJTJJJZCZMLZYJKXZYZMLJKYWXMKJLKJGMCLYKJQLBCKMDXWYXWSLLPSJJJQXYQFJTJDMXXLLCRQYJBMXGGYPJTGE                                                                 GDJGNJYJKHQFQZKHYGHDKLLSDJJXKYQXNZSXWWXDJSGXXJYQSCXQWJEXSWZHYDZ PAQYZMTSTZFCYLDJAGYLCQLYYYGLRQKLDZCCCADSGBRLZJSJWRCGQCDHMMXZDYOHYCQJBEHWNXDHGJLGWQWJHCSTHESJPWMRDSZTXYQPZXYXDQXTPBFYHHDWZBTXHQE                                                                 EDZSXKHTEXWLTXYDNXPHYLPMZHXLBLBMLSFHCYGGBHYJTDWLQCZYDQDQMGDKLLS ZWJQEQAJNYTLXAGZDHCQZWWSGQQDWZBCHYQZLXQGZGLYDQTJTADYZZCWHZYMHYHHJZWSXHDYLYSCQYDPCYWYPXJZHTYHQSYGXMCHRWJBWXZLWJSCSGNQBALZZMTJCJK                                                                 TSAXLXHHGOXZCPDMHGTYSJXHMRLXJKXHFQCTDXEZFCHZCCDJTXQHLXHYXNSYYDZ ZNYXJYAYKYPDXDDXPYZNDLTHHYDXZJJCXMTLHBYNYHMHZLLXNMYLLLPDCPPXMXDKYCYDLTXCHHZNXZLCCLYLZSXZJYZLNRLHYNTKYJPYCHEGWTGQRGTGYHHLGCWYQKP                                                                 YYYTTTTLHYLLYTTPLKYYQQZDQXSNMJZXYQMRTFBJDJJDJPTQZGTJYFLQGXFLZFH ZADPMJHLCCYHDZFGYDGCYXSBHDKDHAXXBPBYYHXCCBDQYJXDLJQZLHBJYDYQSQWJLZKCDTCCBXDYZZQJNKKNJGYEGLFYKASNTCHBLGZBYMJREGZYHEYBJMCTYFZJJFG                                                                 CJPLJHDWXXJKYYKSSMWCTQZLPBZDTWZXZAGYXWXLHLCPBCLLOQMMZSLBQZZKDCZ XGQJDCYTZQWZQSSFPKTFQDZDSDDTDWFHTDYZJAQQKYPDJYXTLJHDRQXXXAYDRJLKLYTWHLLRLLCXYLBWSZYMZZHKHXKSMDSYGJFZBSQLCXXNXYMDQOGQMMCCGGTTYBH                                                                 YJBEDPJXDQHKSBHFDXBAWHWAJLDYJSFHBLDDQJNCXFJHDFJHWZPKZYFCYZYNXFF WDBZZNYTXZEMBSEHXFZMBFLZRSYGZJRDJGXHJGJJNZZXHGJKYMLPEYYSSGQSHXSCXMFWKCCTXNYPNZHZPTMWYWXYYSLJZQXZDLAELMCPJCLXSQHFWWTFFTNQJJQDXHW                                                                 LYZCFLAHYYJLDXHHDYNRJTYWDRMDRQHWQCMFJDYZHMAYXJWZQTXDLMRSPWWCHJB XTGCYYRRLMPAMKQZYJRMYSNTPLNBPYYXMYKYNGJZZHLZHHANMPGWQTZMXXMLLHGDZXYHXKRYCJMFFXYHJFSSQLHXNDYCANNMTCJCYPRRNYTYQYMKSXNDLYLYLJNLXYS                                                                 XHMLLYZLJZXSTYZSMCQYNZLXBNNYLRQTRYYJZZHSYTSCQGXZBCHMKCZYQHZJNBH QSNJNZYBKNJQHSNSWXKHJYYBQCBFLDPZFKJZXSDDJEESSMLXXHWLMWWWYDKZGGTGGXBJTDSZXNXUMLPTFXLCXJJLJSXNWXLAHHHRWHSCYYBYAWJEFWQQJZZYJGXPLTJ                                                                 FTPAKQPTLDPCXTXBHKLEFDLEEGQYMSAWHMLFTWYQLYJEXBQFNLYXRDSCTGGXYWL KXQCTLHJLMKKZGYGLLLDZYDHZWPJZJDYZZHYYFQYTYZS';
   hzpybm_1   CONSTANT VARCHAR (3500) ='EZKLYMHJHTWYZLKYYWZCSKQQTCXWCDRJKLWKBDQYNCSRSZJLKYDCDTLZZACQQWZDDXYPLXCBQJYLZLLQTZJ                                                                 JYJYJZYXNYYYNXJXKGDAZWRDLJYYYRJLGLLYXJCYKYNQCCLDDNYYYKYKHJCLKPP QZZYJXJPFZDNFPZHDDMFMYYPQJRSSQZSQDGPZJWDSQZHZZWYBPDGPTMJTHZSBGZMBJCZHBBZMQCFMBCMCJXLJBGJTZGMQDYBJZYCTYZTZXTGKMYBBCLJSSQYMSCXFJE                                                                 GLSSZBQJJLYDLYCTSXMCWFGKKBQLLLJYXTYLTXDPHNHFJYZYESESDHWTJBSJTFD CZYQSXJDZJQPBSDJGFBKJBXDGQHMGWJJLHHYYYHHWYYCDYPCZTJZWDLFWXWCZJCCCUJZCZLXJJSJBFWPXZPTDZBZCJHMLXBQLRDGRGYSXFYMMWJXJWCYQCTTQHXKXKJ                                                                 YBMPKBNTHCYDTYFXBYXCBHXBSXTYMKSXLHKMZXTDHGXXSHQHCYXGLCSQYPDHQMY YPYYTJZLHQTBQXMYHCWLLCYLNEWCDCMLGGQKTLXKGNDGZYJJLYHQTTNCHXESZJYDNYDCQCBMZTBXWGWBXHMYQDYCMKKAQYNCSYQGYSQYSHJGJCNXKZYCXSBKXHYYLCT                                                                 YXTYMGCPMGCCCCCMZTASGQZJLOSQYLSTMQSQDZLJQQYPLCYCZTCQQPBQJCLPKHC YYXXDTDDSJCXFFLLXMLWCJCXTSPYXNDTJSJWXQQJCKYYLSJHAYGXCYYDMAMDQMLMCZNYYBZKKYFLMCHCLHXRCJJHSLNMTJGGYGJDDZJZKZQGJYYXZXXQHHESTMDSYYY                                                                 QLFRZZDYYHSCTGWDRXQJYBXZZDYKBJWHYQDZYWNPPBAZYBZNBYZZYHNYCPJMQZJ ZPNQTBDJKQQHNGCYXCHBZKDDNZGJDRLZLDJLJYXYTBGTCSKMNJBJSNXCPJJHTPZSYJWBZYZLSTBWWQSMMFDWJYZCTBRZWQCSLQGDHQSQLYZLGNHSZCBTZKPJMJMSPNJ                                                                 ZJJYNHPWSNSZZXHBYHYZXKJTLLCJTHGCXXQCBYWBWZGGQRQCSSRBKYDZNLQXJME CSTJPLTHZWHWQTZENQZWSGSSCSJCCGFDQSLCCGLLZGHZQTHZJGYAZNMCKCSTJCKBJYGQJPLDXRGZYXCNHHDNLZHJJCDDBCJXBFZWPQDHJTQZJYNLZZPCJDSQJKDXQAJ                                                                 YEMMJTDLJYRYYNHJBNGZZKMJXLTBSLLRTYLCSZNXJLLHYLLQQQLXYMCWCXSLJMC ZLTLDWDJLLGGQXKYGBPDKMWHCCGXJCSDYBXDNDDYKYQTXDYXMAADCSLQXYJSJZYLBLXXXQQJZLBYLWSJJYJTDYQQZZZZQLZCDZCHPLMQPLFFJZYSJEZFPFZKSYJJHXT                                                                 TDXCYSMMTCWBBJSHFGXFQHYZFSJYBXPZLHMBXHZSFDWDABALKTSHXKXJJZTHGXH JXKZXSZZWHWTZZZSNXQZYAWLCWXFGYYHXMYYSWQMNJYCYSPJKHWCQHYLJMZXHMCNZHHXCLTJPLXYJHDYYLTTXFSZHYXXSJBJYAYRMLCKDUYHLRLLLSTYZYYHSCSZCXH                                                                 YQFBFLFUNTLJMHTJYZWTLLLPSTRBDDLQJBCCRQYWXFZRTDMCYGGYJMWJMSYFDXC SHXNCSWJJMPAFYFNHYDXYEZYHSDLSZXSXGBMYYYSNBYNLHPFZDCYFMSSSNYZZDGBAFBDBSSZBSGCYJLMLRZSYXQCYXZLSKBRBRBZCYCJZEEYFGZLYZSFRYKQSXDCYZU                                                                 YJLZXSCBTGJBBRXLLFQWJGSQYLPZDXTZABDHZRBJHWNJTJXLKCFSSDQYJKZCWJL BXFTZLLZLQBLCQQCCDFPBHCZLYYGJDGWQFCZQYYYQYRQZFLZZFCQNWLHJCJJCZQYBZZBPDCCMHJGXDGDZQMFGPSYSDFWWJZJYXYYJYHWPBYGXRYLYBHKJKSFTJMMKHT                                                                 YYSXYZPDJYSYWMDJJRHLQXSTWSCBJYZFNMGJTYSYZMSJYJHGQMYRSZWTRTZSSKX GQGSPTGCDNJGQQMXGZTQYDJZDLSXJLHRQGGGTHSCPYJHHGNYGKGGMDZLLCCLXQSTGZSLLLMLCSKBLJZZSMNYTPZSQJCJYXEXZZCPSHGZSXCDFMWRLLQXRFZLYSTCTMS                                                                 JTHJNTNRTZFQRHQGLLGXSCZJDJXCTSJLNYHSZXCGJZYPFHDJSPCCZGJJJZJQDYB SSLYCTMQTBHJQNNYGJYNQYQMZGCJKPDCGMYZHQLLSLLCLMHOLZGDYLFZSLJCQZLYLZCJESHNYLLQXGJXLYJYYYXNBCLJSSWCQQCJYLLCLDQELLZLLBNYLGYQXCCQKYJ                                                                 XXHKLKSEXCQKKKCGYYXYWTJOHTHXPXXXSLCYEYCHBBJQZSCSZSSLZYLGDZMMYSX JQQSQYFYCHDZYWCTJSYCJKCDDJLBDJJZQYSKKXXHQJOHDYXGMAJPCUUBLJSMTXERXJQDUPJDBSMSSTHTSLMMTRZSZMLDJQYNNSQXQYDYYZBDSLNFGBZMDZCWFTTMQPQ                                                                 WWTJZZQJJRJHTBGZFJHNXXYY';
   hzpybm_2   CONSTANT VARCHAR (3500) = 'DYHHNMMCHBZPZZPZFMZTLMYFTSKJJYJZHBZCYGH PCZSCSJYSJFJGDYPSHZCWHJSEXFSZYWKLAYSLYMQPXXSKQJPXZGMWQYJSPCJLQWHMYBDHYYLHLGLCFYTLJCJSCPXSKPHJNTXTETLSSLSDYHXSCZKWTDWJSLHTQDJGGY                                                                 ZPHCQFZLJLZPTYNLMJLLQYNBHYLQQZYBBYWRFYKJSSYPXYRHJNQTFWTWRCHYHMM YYHSMZHNGCELQQMTCWCHPXJJFYYSJZTYBMSTSYJDTQQTLHYNBYQZLCXCNZMYLFLWBYHJYSYLYMZCTDWGSZSLMWZWWQZSAYYSSSAPCWCMGHHQDZXJGSJHYZLCYYXHBBZ                                                                 JKSSMALHYCFYGMQYJYCXJLLJGCZGQJCCTOTYXMTSHLWCGFZKPZCXHJYSLCTJCYH XSGZKXZPYJPDHJWPJWSQXXXDMRSZCYZWTXKYTSHBCSPLWSSCJHJLCJHYLHFHHXJSXALNYLMDHZXYSXLWZYKCLDYHZMGYSPJTQZNGJFSJHCTSDSZLMSSMNYYMJQJCWTY                                                                 YDCHQLJAWBGQYBKFCMJWLZLLYYLSZYDWHXPSBCMLJSCGBHXLQRLJXYSWHXZLLDF HLSLYMJLJYLYJCDRJLFSYZFSLLCQYQFJYYSZLYLMSTDJCYHZLLNWLXXYGYYGXXHHZZXCZQZFNWPYPKPYPMLGXGGBDXZZKZFBXXLZPTYTSWHZJXHQHXXXYWZYSWTMZKX                                                                 XZPHGCHCULFJXPTZTHLYXCRHXSHXKJXXZQDXJULYJLKHTXCWHCFWZFPQRXQXYJY GPXGSCSXNGQCHKZXHFLXJBYZWTSXNNCYJJMWYJQRHFQSYLJZGYNSHGTCEBHXXWYHHXYXSQYMLYWGYQBBCLJLPSYTJZHYZWLHORJKCZJXXYXCHCYTYXQJDDSJFSYLTSF                                                                 XLMTYJMZUYYXLTCXQZLHZLWYXZHTNLXHXJCDYHLBRLMRLLAXKSLLLJLYXXLYCRY LCCGQCMTLZLLYZZPCWHJYZECKZDQYQPCJCYZBBBCYDCNJTRMFGYGBSYKMDQQZMKQLPGZBQCJFKJCXBLJMSWMDTQXLDLBPBXCWKCQJCZGKPHYYHZKZMPJYSTLPNYYXDB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ';
   hzpybm_3   CONSTANT VARCHAR (3500) = '                                                                                                                                                                                                                                                                                                                            KXHHZJXSTTLMXXBZYSHJPFXBQBYLJQKYZZZYLCZGFWYCTYXJBYYSBMSMHDYSHQY ZCHMJMCAHCFBBHPLXTYSXSDJGJDHKXXNB                                                                                                                                                               HNMLNGSLTXMRNLXQJMZLSQGLBHDCGYQYCHWFJYBBYJMJJDPQYAPFXCGJSCRSSYZ LBZJJJLGXZYXYXSQYXBXXGCXPLDYWECDW                                                                                                                                                               WCJMBTXCHXYXXFXLLJSFWDPZCMYLMSWTSBCECBLGDBQZQFJDJHYMCXTXDRMJWRH XCJZCLQDYHLSRSYWWZJYMTLLLTQCJZBTC                                                                                                                                                               KZCYQJZQALMYYZWDXZXQDLLQSGJFJLJHJAZDJGTHHSSTCYJLBSZLXJXRWGLDLZR LZQTGSLLLLLYMXQGDZHBBZLSXQBPFDFMW                                                                                                                                                               HYBJCCLDWZPBZLCYQXLDOZLWDWYYTHCQSCCRSSLBYFPTZMBMXLMYFGJFTMDJWDN MMCTGBDZLFYHSSMJYLDHDZJCCTLCLDLJC                                                                                                                                                               PDDJDSZNBGZXXCJQYCBZXZFZFGSNTTJWHTZMJXTMXSPDSYBZGMMJTACBMDKYCSZ ZYFYCTGWHKYJXGYCHYDZSCYZSSDLLQFLQ                                                                                                                                                               LLXFDYHXGGNYWYLLSDLLBJCYJZMLHLJXYYYTDLLLBUBFFQJZMPCLMJPGEHBCQAX HHHZCHXYHJAXHLPHJGPQQZGJJZZGZDQYBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB                                                                 DHHBWYFFQDLZLJXJPALXZDAGLGMQYXXXFMMSYPFMXSYZYSHDZKJSMMZZSDNZCBP LTDDNMXZYMZMMQHHCCJEMXXKSTGWLSQLZBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB                                                                 LLSJBHLYZYHMXXHHZCJMHXTXFWGMWKDCQMFZZYDKMSCLCMGWRXPSLCXYXWGJYAH JZWCSNXYHMMPMLKXMHLMLGMXTKZJYSZJSBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC                                                                 HYZJZYBDQZWZKGDJLFMEKZJPEZSWJMJYKTEMZNPLPLBPYKKQZKEQLWAKYPLHQWQ CKQCLHYXXMLYCCYSKYZHLCNSZKYZKCQZQCCCCCCCCCCCCCCZCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC                                                                 LJBMJHQLYWQLNRYDTYKWSZDXDTNTQDFQQMGSELSTHPKTXXLWYDLZYZCQAPLLKCC YLBQQCZCLJSLZJXDDPJQDLJXZQJYZHKZLCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDD                                                                 JCYQDYPPYPEAKJYRPCBYMXKLLZLLFQPYLLLMSGJCYRYTMXYZBDZRYSYZTFMSMCL YWZGXZGGSJSGKDTGGZLLDZBCHYYZHZYXXDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD                                                                 STYMSDBZYJGTSMTFXQYJSSDGSLNMDLYTZLRXTRZCYXNQFHYZJZYKBPNLYPBLNZD JHTSHHYZZRDZNFGXSKGJTTYLLGZZBJZKLDDDDDDDDDDDDDDD';
   hzpybm_4   CONSTANT VARCHAR (3500) = 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEE                                                                 PBZYLUYXBJFPNJZZXCDXZYXZGGRSRJKCMZJLSJYWQKYHQJXPJZTZLSNSHRNYPJT WCHKLBSZLCWYSJYLYBBWZJDWWCYXCKDZHEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF                                                                 SGZWWYQYYTCTDJLXWKCCKKCCLZCQQDZLQCSFQCHQHSFMQZLLBBSHJDYSJQPLZCD CWJKJLPCMZWJSQYZYHCPYDSDZNGQMBCFLFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG                                                                 NFFGFSMTQMLGQCYYBKJSRJHZLDCFTLLJGJHTXZCSZZTCGGKYOXPLZPBGTGYJZCZ SZLLJFZGQJCCZPXBSXPXHSYCLWDSJJXMFGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGH                                                                 CFZHQQMQGYYHTYCRZNQXGPDZCSZQLJBHBZCYCZPPYTZSGYHCKPZJLCNSCSSLZXB MSDLDFJMKDJSLXLSZQPQPGJLLYDSZGQLSHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH                                                                 LKYYHZTTNCYQTZZFSZQZTLLJTYYLLQLLQYZQLBDZLSLYYZYFSZSNHNCZQZBBWSK RBCYZMTHGJYZCSHTCLZBLEQHXFLYLJQBZHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHJJJJJJJJ                                                                 GHSTBMZJLXFNBGXJZTSFJMSSNXLKBHSZXTNLZDNTLSJGZJGJCZXYHYHWRWQNZTN FJSCPZSHZJFYRDJFCJZHFZQCHZXFXSBZQJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ                                                                 LZSGYFTZDCSZXZJBQMSZKJRHXJZCGBJKHCHGTXKJQGLXBXFGTRTYLXJGDTSJXHJ JJCMZLCQSBTXHQGXTXXHXFTSDKFJHZYJFJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ                                                                 JXRZLDLLJCQSQZJWQXSWTWGWBZCGCLLQZBCLMQJTZGZXZXLJFRMYZFLXYSZXXJK XRMJDCDMMYXBSQBHGZMWFWXGMXLZBGYTGJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ                                                                 ZYCCDXYZXSWGSYJYZNBGPZJCQSYXCXRTFYZGRHZTXSZZTHCBFCLSYXZLZQMZLMP LXZJSSLBYSMQSXJZXRXSQZZZSSLJFLCZJJJJJJKKQKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKHKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK                                                                 RCRXHHZXQWDSHXSJJHQCXJBDYNSYSRJBQLPXZPYMLXZKYXLXCJLCYCXXZZLLLLL HRZZDXYTYXCXFFQBPXZGYGZTCQWYLTLWWKKKKKKKKKKKLLLLXLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL                                                                 RSGZJMMGTJFSGZYAFSMLBFCWBJCLJMZLPJJLMDYLYFBYGQZMYZYRQQHXYYQQYGY FSFSLNQHCFHCCFXBLPLZQXXXKHHXSHJDSLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL                                                                 CXCZWHHHPLHALPQAHXDLGGGDREDTPSQJJCLJZLJLHYHYQYDHZUZCZYWTEYTXHSL JBDGWXPCXNTJCKLLWKLLCSSTKNZDNQNTTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLSLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMWMMM                                                                 LZSSZYQKCGBHCRRYCQBPPYRWQPXXKDFBBQTZFZNPZFXMQQCYPCXEHZGZTCMXXMX NWWXJRHLSTMCSJTJCXXTCNDNPGLZCJLSBMMMMMMMMMMMMMMMMMMMYMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM                                                                 LPGJCDNNRSZJDPGWMRZCLODANSYZ';
   hzpybm_5   CONSTANT VARCHAR (3500) = 'RTWJJDBCQWSTSZYLJPXLOCLGPCJFZLJYLXC TNLCKXTFZJHCRXSFZDKNJCJLLTQCBXNWZMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN                                                                 XBXKLYLHZLQZLNZQWGLGJJGCMNGJDZXTXCXYXJJXSJTSTPPGHTXDFPTFCLLXQPK FZFLYLUBNJHKBMDDBCYCLDXYDDQLYJJHQNNNNNNNNNNNNNNNNNNNNNOOOOOOOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP                                                                 LLCSJPYYCLDTQPYCMGYHZHSZTWQWRFXLJGACMRHCYYSPDDLYBYZNPBXYXHZDDNH MSGBWFZZJCYXGLRCCYHZLWJGCHGJYZFMZPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ                                                                 QZHFGDCJEAQCPJLSZDCZDWLDFRYBYSCCWBXGZMZZTQSCPMXJCJYCHCJWSNSXWJN MTNMCDQDZLLWNKPZGGLCCZMLBQJQDJJQTQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ                                                                 GHQAWBZJLTTDHHCCHFLSYYTQWCKTJBYPBPDQKXWYYFLXNCWCSBMAYKKJMZZZRXY AQJFLJPHHHXTZQMHSGZQWBWJDYJQZHSLZQQQQQQQQQQQQQQQQQQQQQQQQQQRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSS                                                                 YYMYSZGSXUWYSYSCSYZRLQYLJXCXTLHDQZPCYCYPPNXFYRCMSMSLXGLGCTLXYGZ GZTCPDSLLDTMTZALCPQJCJWTCYYZBLBZLSSSSSSSSSSSSSSSSSCSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSCSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS                                                                 QMYLJBGHDLSSDHBDCSXHAMLZPJMCNHJYJYGCHSKQMZZLWJQSMOCDRLYQZHJMYBY LRETFJFRFKSYXFDWDSXXSYSJSLYXSNXYYSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS                                                                 XHAHHJCXWMLJCSQLKYDTTZSXFDXGSJHSXYBDPWNCMPJZCZENYCXQFJXKBDMLJQQ LXSLYXXYLLJDZBYMHBSTTQQWLHOGYBLSZSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSTTTTT                                                                 ALXQLTWRRQLSTMYPYXJJXQSJPBRYXYJLLYQYLTHYLYMLGLJDMLLHFZWKHLJLHLJ KLJSTLQXYLMBSXCHXCFXLHHJJBYZZKBXSTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT                                                                 DQDUJZSYHZXFEBCQWYYJQTQYJHQQZMWFFHFRBNDPCJLFZGPPXDBBZTTYGCHMFLY XLYPJSYWMQGQEXJQJTCBHXSFXLBYYJDDHTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTWWWWWWWWWWWWWWWWWWWWWWWWMWWWWWWWWWWWW                                                                 ZJQYJSLLDTKHHBFWDYSQRNWLDEBDWCYULJTMXMJSXYRWFYMWRXXYSCTZZDYMLDQ LWYQYJBSCXWLBRJWXHYBHYDNHHGMYWYTZWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWZWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXXXXXXXXXX                                                                 CSQDSDLWDCQPYCLQYJWXWZZMGLCLMXCMZSQTZPJQBLGXJZFLJJYCJNXWCXSCCDL SYJDQCXSQYCLZXZZXMXQRJHZJPHFLJLMLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                                                                 QNLDXZLLLFYPNGYSXCQQCMJZZHNPZMEKMXKYQLXSTXXHWDCWDZGYYFFJZDRZJZX RZJCHRTLBYZBSJHXZYPFDFGZZRYTNGXZQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                                                                 YMBUCCKRPJBJERZGYKHXKNSJKLJSGZLJYBZSQLBCKTYLCCCLPFYYDZYQGKQTTFC XDKDXXYFYTYHPDYTGHRYNJSBSNYJHKLLSXXXXXXXXXXXXXXXXXXXXXXXXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY         ';
   hzpybm_6   CONSTANT VARCHAR (3500) = '                                                        LYDXXWBCJSBQFJZJCJDZFBXXBRMLAZGCSNCLDSTBLFZTSWSBXBCLLXXLZDTZSJY LYYFFFBHJJJGBYGJPMMMPSSCZJMTLYZJXYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY                                                                 SWXTYLEDQPJMYGQZJGDJLQJWJQLLSDGYTQJCZCJDDHQGSGJHQXNJJZBXSGZXCXY LJXYXYDFQQJJFXDHCTXJDRXYSQTJXYEFYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYXYYYYYYYYY                                                                 YSSYXJXNCYZXFXCSYSZXYYSCHSHXZZZGZZGFJDLDYNPZGYJYZTYQZPBXQBDZTZC ZYXXYHHSCXSHCGGQHJHGXWSCTMMLHYXGEYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZY                                                                 BTYLZKKWJZRCLEKETDBCYKQQSAYXCJXWWGSBHJSZSDHCSJKQCXSWXFCTYNYDPZC CZJJTZWJQDZZZQZLJCXLSBHBYDXPSXSHHZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ                                                                 EZDXFPTJQYZZXHYAXNCFZYYHXGNXMYWXTZSBKHHGYMXMXQCXTSBCQSJYXHTYYLY BCLMMSZMJZJLLCOGXZAAJZYHJMCHHCXZSZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ                                                                 XZDZNLEYJJZJBHZWZZSQTJPSXZTDSXJJZNYAZHHYYSRRQDTHZHAYJYJHDZJZLSW CLYBZYECWCYCRYLCXNHZYDZYDTRXXBZSXZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ                                                                      QHXJHHHXXLHDLQLDBSXFZZYYCHTYYJBHECJKGJFXBZJFXHWHDZFYAPNPGNYMSHK HALNBYJTMXYJCTHJBZYFCGDYHWPHFTGZZCQWGNSPGCGNEGYPBTYYZDXYKYGTZJNMJQMBSGZSCYJSYYFPGKBZGYDYWJKGKLJYWKPJQHYJWRDZLSYMRYPYWWCCKZNKYYG                                                                 EZSBZEGPBMDSKFTYCMHBLLHGPZJXZJGZJYJZSBBQSCZZLZCCSTPGXMJSFDCCZLZ DJXCYBZLFCJSAZFGSZLYBCWZZBYZDZYPSTTNQJNYKKZYTCJNMCYLQLYPYSFQRPZSLWBTGKJFYXJWZLTBNCXJJJJTXDTTSQZYCDXXHGCKBPHFFSSTYBGMXLPBYLLBHLX                                                                 WYJGXZBDSYSXLGZYBZFYXTXCCXTZLSQYXZJQCCCDDXZJJQCGXTDGSCXZSYJJQCC LDQZTQCHQQJZTEZKKJCFYBQTYJLMKCQZJSMZMYJHSOJNGHDZQYKLGJHSGQZHXQGKEZZWYSCSCJXYEYXADZPMDSSMZJZQJYZCJJFWQJBDZBXGZNZCBWHWXHQKMWFBPBY                                                                 TPJNYJDDZQZXDPZJCDJSTCJNXBQMSJQMJJWWJJNJNLLLWQZQQCZPZYDCYDZCGTF CNCTQNDTJLZBCLLTDSXKJZQDPZLZNTJXZDTJZZKXXYLYGXFPTYJYYZPSZLFCHMQSHGMXXSXJYKDCSBBQBEFSJYHWWGZKPYLQBGLDLCDTNMAYDDKYSNGYCSGXLYZAYPN                                                                 BCJLTQQLDGDBBJQDCJWYNZLZCDWLLXWLRSNTQJCZXKJLDSTDGLHLAJJKLYXKQLL DZYTDYYCYGJYXDXFRSKSTCDENQMRKQZHHPTSDKDYLHGYMYLCXPYAQNDQJWXQXFYYFJLEJBZRXCCQWQQSBZKYMGPLBMJRQCFLNYMYQMTQYRBZJTHZTQFRXQHXMJJCJLX                                                                 QKDLDAZFKYPBGGPZREBZZYKYQSPEGJJGLKQZZZSLYSYWYZWFQZNLZZLZHWCGKYP QGNPGBLPLRRJYXCCCGYHSFZFWFZYWTGZXQGJMSHZKBSWYEMYLTXFSYDSGLYCJQXSJNQBSCTYHBFTDCYZDJWYGHQFSXWCKQKXEBPTLPXJZSRMEBWHJLBJSLYYSMDXLCL                                                                 YLJCZWHXZJZBLFFLGSKHYJDEYJHLPLLLLDZLWCZBLCXBBXBCBBNNZCYRDSYCGYY QBWTZDHDEDCCZCZTYKHDYNYJLXDJYQDJYQKXLHXJRZJMFQHXHWYWSBHTRXXGLHQHFNMGYKLDYXZPYLGGSMTCFPAJJZYLJTYANJGBJPLQGSZYQYAXBKYSECJSZNSLYZH                                                                 ZWLSHGLBCZBYZJYCTDYNDSYCTSZYYEGDWNYCXTDCYSHGZSCCSDDLCCRQXYYELSM HZTEBBLYYLLTQSYRXFKBXSYCHBJBWKGSKZXLZCGHPXZHZNYTDSBC';
   hzpybm_7   CONSTANT VARCHAR (3500) = 'JKTLZYYFFYDLEPBWQYZKXGLDNDNYSKJSHDLYXBZGYXYPKDJMMZNGMMCLGWZSZXZJFZNMLZZTHCS                                                                 GHJHXXGNLYCDLFWLJGBXBXQQZZPLNYBXJYQYMRBSYYHKXXSTMXRCZZYWXYHYMCF LZHQMQXDBXBZWZMLDMYCKFMKLZCYQYCZHYDBDLLSCDTNLKJYKJSYCJLKOHQASDKNHCSGSEHDAYSHTCPLCPQYBSDMPJLPZJOQLCDHJJYSPRCHNWJNLHLYYQYHWZPTCZG                                                                 XZLYYZMDDZYFTQPCZCYYPZHWLLYTZTZXDTQCYPKSCCYYAZJPCYLZYJTPNYYYNRC YLMMNXJSMYBSSLJGYLDZDPQHZZBLFNDSQWWMZFFJQQQQYXACLBHKDJXDGMMYTJXZLLSYGXGKJRYWZWYCLZMSSJZLDBYDCPCXYHLXCHYZJQSQQHGMNYXPFRKSSBJLYXY                                                                 KCZFHHHGQMRDSXYCSTXNQQRPYJBFCXDYQFBNXEJDGYQBSRCNFYYQPGHYJDYZXGR HTKHLEQDZNTSMGKLBSGBPYSZBYDJZSSTJSYGLNSCMHCWWMNZJJLXXHCHSYZSXTXRYCYXBYHCSMXJSZNPWGPXXTAYBGAJCXLYXDCCWZOCWKCCSBNHCPDYZNFCYYTYCKX                                                                 ZSTXZBHBSCSBZCZPTQFZMQFLYPYBBJGSZMXXDJMTSYSKKBTXHJCEGBSMHYJZCXT MLJYXRZZSCXXQPTZHMKDXXXJCLJPRMYYGKYBSQKKYTQQXFCWCHCYKELZQBSQYJQCCLMTHSYWHMKTLKJLYCXWHEQQHTQKPPQSQSCFYMMDMGBWHWLGSLLYSTLMLXPTHMJ                                                                 ADYSKQKNDHRSKQXZXZTCXHZTLMLWXYBSYCTBHJHJFCWZSXHWTKZLXQSHLYCZJXE MPLPRCGLTBZZTLZJCYJGDTSLKLPLLQPJMHWLJZYHZJXKTXJLHXRSWLWZJCBXMHZQXSDZPMGFCSGLSXYMQSHXPJXWMYZKSMYPLRTHBXFTPMHYXLCHLHLZYLXGSSSSTCL                                                                 ZPAPXYZLAKTKDNCZZBNCCTDQQZJYJGMCTXLDGCSZLMLHBGLKKBNWHDXUHLFMKYC LGXDTWZFRJEJCTZHYDXYKSHWFZCQSHKNQSLDCLRPBHZHXYYFHBMGDMYCNQQWLQHJJCYWJZYEJJDHPBLQXTQKWHLCHQXAGTLXLJXMSLXHTZKZJECXJCJNMFBJCSFYWYB                                                                 QHTCHYMJDJSKHXZJZBZZXYMPAJQMCDBXLSKYYNWRTSQGSCBPDBSGZWYHTLKSSSW GZZLYYTNXJGMJKHSXFWNLSOZTXGXLSMMLJZGNYSDZSQYRSLJPCLPWXSDWEJBJCBCNAYTWGMPAPCLYQPCLZXSBNMSGGFNZJJBZSFZYNTXHPLQKZCZWALSPCCJXSYZHWK                                                                 BWLDSCYLKQCQSTMYCFJBSLXCLZJCLXXKSBZQZLHJPHQPLSXSCGSLNHPSFQQXTXJ JZLQLDXZJJZDYYDJNZPTUCDSKJFSLJHYLYPSGXFZFCDKHJGXTLQFSGDSLQWZKXTMHSBGZMJZRGLYJBPMLMSXLZJQQHZYJCZYDJWBMJKLDDPMJEGXYHYLXHLQYQHKYCW                                                                 ZQJZLBTHYDGDJFDYAZXDZHZJNHHQBYGNXJJYCZMLLJZKSPLDSCLBBLXKLELJLBJ YCXJXGCNLCQPLZLZNJTZLSYXBXMYZXWQCCJMYYXNATJHYCCXZPCQLBZWWYTWSQCMLPMYRJCCCXFPZNZZLJPLXXYZTZLJDLTCKLYRZZGQTGJHHGJLJAXFGFJZSLCFDQZ                                                                 ZYHZBTRBLHLCCCJADJLMMMSSHMYBHBCKKBHRSXXJMXLDZNZPXLBBRHGGHFCHGMS KLLTSJYYCQLCSKYWYEHYWHBHQYWBAWYKQLCLGJDJCZNZLLJPJQDCCLCJXMYZFTSXGCGSBRZXJQQCTZHGYQTJQQLZXJYLYLBCYAMCSTYLPDJBYREGKLZYZHLYSZQLZNW                                                                 LDQPTNTKHQCGDQKTGPKXHCPDHTWUHKDHTHLXYTYYDESPKYZPCEQDLTBDSDEGYJQ XCWXSSPZXDFQDLYJCLSXYZYRXCYYYDWNDCZCLLWJQJJJKDGJZOLBBZPPGLGHTGZXYJHZMYCNQSYCYHBHGXKAMTXYXNBSKYZZGJZLQJDFCJXDYGJQJJPMGWGJJJPKQSB                                                                 AJQYHYWTJDAXYSRLTDPSAXFNEJDYZLXLLHZYQJHGJHZYCSHHSGCZYJGLLNYZCJN FSMFPYCYAWDDHDMCZLQZHZYSTLDYWLLHYGBMMCJSSCLPQPDXCDYYKYPCJDDYYGYWRHJRTGZNYQLDKLJSZZGZQZJGDYKSHPZMTLCPWNJYFYZDJCNMWESCYGLBTZCGMSS                                                                 MMYLMBWWKXYDTYLDJPYWUXJMMLLHAFDLLAFLBHHHBQTZCQJJTFMPMHYDCJRDDWR QNYSNMZBXYTBJHPBYGTJAHGQTBSTXKBTSLLYXQSXXBSJSBBSGGHFJLYPMZJNLYYWDQSHZXTYYWHMZYHYWDBXBTLMSYYYFSXJCHDXXLHJHFSSXZQHFZMZCZTQCXZXRTT                                                                 BKLXBEQQHQMJDWTTXPGBKTLGQXJJJCDH';
   hzpybm_8   CONSTANT VARCHAR (3500) = 'XQDWJLWRFMQGWQHCKRYSWGBTGYGBWSD WDFJXXXJZLPHYYPAYXHYDQQXSHXYXESKQDJHNNYZQQMTQDMMGYYTXMJGDXCDYZBFFALLZTDLTFXMXQZDNLWQDBDCZJDXBZGSQQDDJCMBKZFFXMKDMDSYYGZCMLJDSYN                                                                 HYWBDDDPPLCJLHQEEWJKSYYKDYPLFJTHKJLTCYJHHJTTBLTZZCDLTHQKCJQYSTE EYWKYZYXXYYSDDJKLLPWMCYHQGXYHCRMBSBRSKMKMPCKLGTBQTFZSWTFGGLYPLLJZHGJJGYPZLTCSMCNBTJBQFKDHBYZGKPBBYMTDSSXTBNPDKLEYCJNYDDYKZTDHQH                                                                 XPLLNQTJHYYLFBGFXZBSBTLGXXJBSWYYSKSFLXLPPLBBBLBSFXYZSYLFFFSCJDS TZTRYYCYFFSYZYZBJTBCTSBSDHRTJHBYTSDZSCTARLLTKZLGECLLKJLQJAQNBDKKGHPJTZQKSECSHALQFMMGJNLYJBBTMLYZXDXJPLDLPCQDHZYCBZSCZBZMSLJFLKR                                                                 CXYJELXBNEBJDSYSYHGSJCBXBYDFZWGENYHHHJHAXFWGCSTBGXKLSTYWMTMBYXJ SKZSXDYJRCWXZFHMYMCXLZNDTDHLXDJGGZJSNFRGJHXPDHYJYBZGDLQCSEZGXLBLHYXTWMABCHECMWYJYZLLJJYHLGNDJLSLYGKDZPZXJYYZLWCXSZFGWYYDLYHCLJS                                                                 YBFBNBBTHFJAAXYFPXMYFHDTTCXZZPXRSYWZDLYBBJTYQWQJPZYPZJZNJPZJLZT FYSBTTSLMPTZRTDXQSJEHBZYLZDHLJSQMCMBJHBLYZLYCBLYDPDQYSXQZBYTDKYYJYYCNRJMPDJGKLCLJBZXBJDDBBLBLCZQRPPXJCJLZCSHLTOLJNMDDDLNGKATHQH                                                                 LHTXTJECXSLZZSPKTLZKQQYFSYGYWPCPQFHQHYTQXZKRSGTGSQCZLPTXCDYYZSS QZSLXLZMACPCQBZYXHBSXLZDLTCDJTYLZJHYKHEZNMSHRPHQQJCHGMFPRXHJGDYCHGKLYRZQLCYQJNZSQTKQJYMSZXWLCFQQQXYFGGYPTQWLMCRNFKKFSYYLQBMQAMM                                                                 JYYTPZYLLTXJSJXHLBRYBXQZSKSWWWYGYABBCTQKTGPOSBXBBCMLLXZTBKLGQKQ LSKDFXRDKBFPFTBBMFEEQGKPZSSTLBTPSMYXCTPSHCPTXXZZSMPHPSHMCLMLDQFYQXSZYJDJJZZHQPDSZGLSTJBCKBXYQZYSGPSXQZQZRQTBDKWXZKHHGFLBCSMDLDG                                                                 ZZSJDHLQLZPMSMMSXLQQNKNBRDDNHXDKDDJYYYFZGZLGSMJQGXYTQLGPBJXCYZY DRJBHTDJYEJSHTMJSBYPLWHLZFFNYNMHXDZDBLZYYCXNNCSYBZBFGLZZXSWMSCCMQNJQSBDQSJTXXMBLTXZCLZSHZCXRQJGJYLXZFJPHYMZQQYDFQJQLZZNZJCDGZYG                                                                 QHPLTBQPFBCWJDBYGPNXTBFZJGSDCTJSHXEAWZZYLLTYYBWJKGXGHLMKXTJTMSZ SQYNZGGSWQSPHTLSSKMCLSKYSZQQXNCJDZTXMZYSCTLKPHTXHTLBJXJLXSCDQXCBBTJFQZFSLTJBTKQBXXJJLJCHCZDBZJDCZJDCPRNPXCJPFCZLCLZXZDMXMPHJSGZ                                                                 QGZDLFNYKLJCJLLZLMZZNHDSSSHTHXZLZJBBHQZWWYCRDHLYQQJBEYFSJXTHSRH WJHWPSLMSSGZTTYEYQQWRHLALHMJTQJSMGSZZQJYLWTJPFSYAXMCJBTZYYCWMYTZSJJLQCQLWZMALBXYFBPNLSFHTGJWEJJXXGLLJSTGSHJQLZFKCGNNDSZFDEQFHBS                                                                 XQPJJZJXZYZKXBYQXBJXSHZSSFGLXYXZXFGHKZSZGGYLCHSARJXHSLLLMZXELGL XDJTBHYZBPKTZHKZJYQSBCTWWQJPJWXHGAQTGYLBXMMYGSZLDYDQMJJRGBJTKGDHGKBLQKBDMBYLXWCXYTTYBKMRTJZXQJBHLMHMJJZMQASLDCYXYQDLQCAFYWYXQHZ                                                                 ZGNYFLJBYFDJFRGSFMBYZHQFBWJSYFYJJPHZBYYZFFWODJRLMFTMLBZGYCQXCDJ YGZYYYYDYTYDWEGAZYHXJLZYYHLRMGRJX                                                                                                                                                               ZCLQTELJJTHTBWJYBJJBXJJTJTEEKHWSLZKLPSFAZPQQBDLQJJTYYQLYZKDKSQJ YYJZLDQCGJQYZJSYCMRAQTHTEJMFCTYHY                                                                                                                                                               PKMHYCWJDCFHYYXWSHCTXRLJGJSHCCYYYJLTKTTYTMXGTCJTZAYYOCZLYLBSZYW JYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLX                                                                                                           ';
   hzpybm_9   CONSTANT VARCHAR (3500) = '                                                    YJZYZYYPNHMYMDYYLBLHLSYYGQLLSCXLXHZWKQGYSHQYWLJYYHZMSLJLJXCJJYY CPCPZJMYLCJLNJJJLXXJMLZJQLYCMHCFM                                                                                                                                                               MFPQQMFXLMCFQMMMZNFHJGTTHKHCHYDXTMQDYMYYDYYYDZDCYMDYDLFMYCQCWZZ MABTBCMDZGDFYCGCYTTNFWBDTZQSSSTJJ                                                                                                                                                               HJYTSXLYWWHXEXWZNNQZJZJJCCCHYYXBZXZCYJTLLCQXYNJYCYYCYNZZQYYYEWY CZDCJYHYLPGPYLLGKDLDGQBCHJXY                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ';

BEGIN
  hzlen = COALESCE(LENGTH (v_str), 0);
  hasspace = 0;

  FOR pos IN 1 .. hzlen
  LOOP
     hz = SUBSTR (v_str, pos, 1);
     hzbm = bytea_to_int(convert_to(hz,'gbk'));

     IF hzbm BETWEEN 0 AND 127
     THEN
           hz = UPPER(hz);         --大写, 并只允许 0-9 和 A-Z 字符
           IF (hz >= '0' AND hz <= '9') OR (hz >='A' AND hz <= 'Z') THEN
                py = CONCAT(py, hz);
           END IF;
     ELSE
        BEGIN
           hzbm = hzbm - 32767;
           --少减1, 因为下面使用字符串定位, 起始基址为1
           CASE
              WHEN hzbm < 0
              THEN
                 hzpy = '';
              WHEN hzbm < 3500
              THEN
                 hzpy = SUBSTR (hzpybm_0, hzbm, 1);
              WHEN hzbm < 7000
              THEN
                 hzpy = SUBSTR (hzpybm_1, hzbm - 3500, 1);
              WHEN hzbm < 10500
              THEN
                 hzpy = SUBSTR (hzpybm_2, hzbm - 7000, 1);
              WHEN hzbm < 14000
              THEN
                 hzpy = SUBSTR (hzpybm_3, hzbm - 10500, 1);
              WHEN hzbm < 17500
              THEN
                 hzpy = SUBSTR (hzpybm_4, hzbm - 14000, 1);
              WHEN hzbm < 21000
              THEN
                 hzpy = SUBSTR (hzpybm_5, hzbm - 17500, 1);
              WHEN hzbm < 24500
              THEN
                 hzpy = SUBSTR (hzpybm_6, hzbm - 21000, 1);
              WHEN hzbm < 28000
              THEN
                 hzpy = SUBSTR (hzpybm_7, hzbm - 24500, 1);
              WHEN hzbm < 31500
              THEN
                 hzpy = SUBSTR (hzpybm_8, hzbm - 28000, 1);
              WHEN hzbm < 35000
              THEN
                 hzpy = SUBSTR (hzpybm_9, hzbm - 31500, 1);
              ELSE
                 hzpy = '';
           END CASE;

           IF hzpy <> ' ' THEN
               py = CONCAT(py, hzpy);
           END IF;
        END;
     END IF;
  END LOOP;

  RETURN py;
END;
$BODY$
  LANGUAGE plpgsql IMMUTABLE
  COST 100


方案2(部分转换不了,不推荐)


CREATE OR REPLACE FUNCTION "public"."pinyin_first_char"("s" varchar)
  RETURNS "pg_catalog"."varchar" AS $BODY$
declare
  retval character varying;
  c character varying;
  l integer;
  b bytea;  
  w integer;
	
-- 【汉字转为首字母大写】-- 推荐使用【pinyin_first_cap】
-- 小写字母会被转为大写,中文转为拼音首字母大写,其他原样输出(GB18030字符集有限,少部分字无法转换原样输出,该函数还有待改进)
-- SELECT pinyin_first_char('hello WORLD,你好,世界')
-- HELLO WORLD,NH,SJ

begin
l=length(s);
retval='';
while l>0 loop
  c=left(s,1);
  b=convert_to(c,'GB18030')::bytea;
  if get_byte(b,0)<127 then
    retval=retval || upper(c);
  elsif length(b)=2 then
    begin
    w=get_byte(b,0)*256+get_byte(b,1);
    --汉字GBK编码按拼音排序,按字符数来查找
    if w between 45217 and 45252 then --"A";45217;45252;35
      retval=retval || 'A';
	elsif w between 45253 and 45760 then --"B";45253;45760;507
      retval=retval || 'B';
	elsif w between 45761 and 46317 then --"C";45761;46317;556
      retval=retval || 'C';
	elsif w between 46318 and 46825 then --"D";46318;46825;507
      retval=retval || 'D';
	elsif w between 46826 and 47009 then--"E";46826;47009;183
      retval=retval || 'E';
	elsif w between 47010 and 47296 then--"F";47010;47296;286
      retval=retval || 'F';
	elsif w between 47297 and 47613 then --"G";47297;47613;316
      retval=retval || 'G';
	elsif w between 47614 and 48118 then --"H";47614;48118;504
      retval=retval || 'H';
	elsif w between 48119 and 49061 then --"J";48119;49061;942
      retval=retval || 'J';
	elsif w between 49062 and 49323 then--"K";49062;49323;261
      retval=retval || 'K';
	elsif w between 49324 and 49895 then --"L";49324;49895;571
      retval=retval || 'L';
	elsif w between 49896 and 50370 then --"M";49896;50370;474
      retval=retval || 'M';
	elsif w between 50371 and 50613 then --"N";50371;50613;242
      retval=retval || 'N';
    elsif w between 50614 and 50621 then --"O";50614;50621;7
      retval=retval || 'O';
	elsif w between 50622 and 50905 then--"P";50622;50905;283
      retval=retval || 'P';
	elsif w between 50906 and 51386 then --"Q";50906;51386;480
      retval=retval || 'Q';
	elsif w between 51387 and 51445 then--"R";51387;51445;58
      retval=retval || 'R';
	elsif w between 51446 and 52216 then --"S";51446;52217;
      retval=retval || 'S';
	elsif w between 52218 and 52697 then --"T";52218;52697;479
      retval=retval || 'T';
	elsif w between 52698 and 52979 then--"W";52698;52979;281
      retval=retval || 'W';
	elsif w between 52980 and 53688 then --"X";52980;53688;
      retval=retval || 'X';
	elsif w between 53689 and 54480 then --"Y";53689;54480;791
      retval=retval || 'Y';
	elsif w between 54481 and 55289 then --"Z";54481;55289;808
      retval=retval || 'Z';
	else retval=retval || c;
    end if;
    end;
  end if;
  s=substring(s,2,l-1);
  l=l-1;
end loop;
return retval;
end;
$BODY$
  LANGUAGE plpgsql IMMUTABLE
  COST 100

你可能感兴趣的:(数据库,postgresql,数据库)