Oracle filter 函数,Oracle数据库之SQL单行函数---字符函数续
前一篇博客練習(xí)了一些字符函數(shù),之后自己又去下查閱了相關(guān)的資料,上一篇博客中還有很多的
字符函數(shù)沒有練習(xí)到,這次主要是對(duì)上次的一些未用到的字符函數(shù)進(jìn)行一些補(bǔ)充練習(xí)。
ascii()
返回與指定的字符對(duì)應(yīng)的十進(jìn)制數(shù),若為字符串則返回字符串首字母的十進(jìn)制數(shù)。select ascii('AAA') A,ascii('aa') a,ascii('0') ZERO , ascii(' ') space from dual;
chr()
與ascii函數(shù)相反,給出整數(shù)返回特定的字符select chr(65) x,chr(97) y from dual;
instr(C1,C2,I,J)
在一個(gè)字符串中搜索指定的字符,返回指定額字符的位置,只檢索一次
C1:被搜索的字符串
C2:希望搜索的字符串
I:搜索的開始位置,默認(rèn)為1,若果為正,從左到右開始檢索,反之。為0不檢索
J:出現(xiàn)的位置:tips:這個(gè)位置指的是第幾次出現(xiàn)。默認(rèn)為1,為負(fù)或0則系統(tǒng)報(bào)錯(cuò),
例子:select instr('Oracle hello Oracle hello','Oracle',-1,2) from dual;
ltrim、rtrim
select RTRIM('hello oracle','oracle') from dual;--結(jié)果為hello:刪除右邊的‘oracle’
soundex
很有意思的一個(gè)函數(shù)返回一個(gè)與給定字符串讀音相同的字符串
create table test_soundex ( username varchar2(20) ); insert into test_soundex values('Kiritor'); insert into test_soundex values('Kirito'); insert into test_soundex values('kiritor'); insert into test_soundex values('Alex'); select username from test_soundex where soundex(username)=soundex('Kiritor');
???????????
字符串處理函數(shù)中有一個(gè)TRIM函數(shù)筆者會(huì)找個(gè)時(shí)間詳細(xì)的理解、練習(xí)。
總結(jié)
以上是生活随笔為你收集整理的Oracle filter 函数,Oracle数据库之SQL单行函数---字符函数续的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 自 2007 年史蒂夫・乔布斯宣布初代
- 下一篇: oracle 双引号替换,oracle