字符函數:
concat:(字符連接函數)
--字符連接 select concat('con','cat') from dual; select 'co'||'nc'||'at' from dual;
initcap:(首字符大寫)
--首字符大寫
--其余全部小寫
select initcap('initCAP') from dual;
instr:(字符串查找)
--字符串查找
--參數1:被查找的字符串
--參數2:要查找的字符串
--參數3:查找的其實位置
--參數4:第幾次出現
select instr('31415926535','926') from dual;
upper、lower:(字符串大小寫)
--字符串大小寫
select upper('upper'),lower('LOWER) from dual
lpad、rpad:(字符左右補充)
--字符補充函數 --參數1:原字符串 --參數2:補充后達到的個數 --參數3:補充的字符 select rpad('11',10,'*') from dual; select lpad('11',10,'*') from dual;
ltrim、rtirm:(字符左右刪除)
--字符刪除函數
--參數1:要進行刪除的字符串
--參數2:從字符串的左/右刪除指定的字符參數2,第二個參數省略則刪除空格 select ltrim(' rtrim') from dual; select rtrim('11******','*') from dual; select ltrim(rtrim('***11****','*'),'**') from dual;
substr:(截取字符串)
--截取字符串
--參數1:原字符串
--參數2:選擇開始的下標,從1開始
--參數3:選取的個數
select substr('31415926535',3,8) from dual;
replace:(替換字符串)
--替換字符串
--參數1:原字符串
--參數2:需要替換的字符
--參數3:替換成的內容
select replace('**字符串','**','替換') from dual;
trim:(去除空格)
--去除空格
--參數1:刪除的字符,如果和from一塊省略則刪除兩邊的空格
--參數2:進行操作的字符串 select trim(' 111 ') from dual; select trim('*' from '****111****') from dual;
--leading從左邊開始刪除,trailing從右邊刪除,both默認方式,從兩邊刪除 select trim(leading '*' from '**$$111') from dual; select trim(trailing '*' from '111**') from dual; select trim(both '1' from '111*111') from dual;