案例 備註必須大寫
select * from lz_dwjbxx where ( getpycode(dwmc) like '%hf%' or dwmc like '%hf%')
create function "getpycode" (p1 varchar2) return varchar2 as
/** 獲得漢字拼音首字母
* 入口引數:漢字字串、是否只取第乙個漢字的拼音首字母
*/char1 varchar2(2);
char2 varchar2(2);
len integer;
n1 integer;
n2 integer;
csound varchar2(32767);
begin
csound:='';
if p1 is null then
return csound;
else
len := length(p1);
end if;
if p1 ='' then
return csound;
else
len := length(p1);
end if;
if len=null then
return csound;
else
len:=len;
end if;
for i in 1..len loop
char2 := substr(p1, i, 1);
n1 := floor(ascii(char2) / 256);
n2 := mod(ascii(char2), 256);
if n1 = 0 and n2 <= 129 then
char1 := char2;
elsif n2 <> 127 and n2 <> 255 and not (n2 >= 0 and n2 <= 63) then
select
case
when char2 >= '丂' and char2 < '芭' then 'a'
when char2 >= '芭' and char2 < '擦' then 'b'
when char2 >= '擦' and char2 < '搭' then 'c'
when char2 >= '搭' and char2 < '蛾' then 'd'
when char2 >= '蛾' and char2 < '發' then 'e'
when char2 >= '發' and char2 < '噶' then 'f'
when char2 >= '噶' and char2 < '哈' then 'g'
when char2 >= '哈' and char2 < '擊' then 'h'
when char2 >= '擊' and char2 < '喀' then 'j'
when char2 >= '喀' and char2 < '垃' then 'k'
when char2 >= '垃' and char2 < '媽' then 'l'
when char2 >= '媽' and char2 < '拿' then 'm'
when char2 >= '拿' and char2 < '哦' then 'n'
when char2 >= '哦' and char2 < '啪' then 'o'
when char2 >= '啪' and char2 < '期' then 'p'
when char2 >= '期' and char2 < '然' then 'q'
when char2 >= '然' and char2 < '撒' then 'r'
when char2 >= '撒' and char2 < '塌' then 's'
when char2 >= '塌' and char2 < '挖' then 't'
when char2 >= '挖' and char2 < '稀' then 'w'
when char2 >= '稀' and char2 < '壓' then 'x'
when char2 >= '壓' and char2 < '匝' then 'y'
when char2 >= '匝' and char2 <= '鼱' then 'z'
endinto char1
from dual;
else
char1 := 'er';
end if;
csound := csound || char1;
end loop;
return csound;
end;
/
orcale資料恢復
恢復已刪除的表 select from aak file drop table aak file select from recyclebin where original name aak file flashback table aak file to before drop desc aak ...
ORCALE學習筆記
chr 函式表示返回指定 ascii 碼的字元,作用和 ascii 相反。ascii 函式表示返回指定字元的ascii碼,作用和 chr 相反。add months y 在 x時間點往後延遲y個月,y為負則往前推延 execute immediate用法1 立刻執行sql語句trunc 類似擷取函式...
orcale 替換函式
2017年11月21日 10 05 22 1.translate 語法 translate char,from,to 用法 返回將出現在from中的每個字元替換為to中的相應字元以後的字串。若from比to字串長,那麼在from中比to中多出的字元將會被刪除。三個引數中有乙個是空,返回值也將是空值。...