文件名称:Oracle 基础语句 函数大全(字符串函数
文件大小:16KB
文件格式:DOCX
更新时间:2015-03-30 06:50:39
Oracle 基础语句 函数大全 字符串函数 oracle
ORACLE PL/SQL 字符串函数、数学函数、日期函数 --【字符串函数】 --字符串截取substr(字段名,起始点,个数) select Name,substr(Name,2,4),substr(Name,0,3),substr(Name,-2,3),substr(Name,-2,1) from t1; --字符串从前面取三个(0开始) select Name,substr(Name,0,3) from t1; --字符串从后面取三个 select Name,substr(Name,-3,3),length(Name) 串长度 from t1; SELECT ASCII('A'),ASCII('B') from dual; select CHR(100),CHR(80) from dual; select CONCAT(CHR(65),CONCAT(CHR(67),CHR(98))) from dual; select CHR(65)||CHR(66)||CHR(76) from dual; --将每个单词的第一个字母大写其它字母小写返回。 select INITCAP('substr,abc,substring') from dual; --返回i在MISSISSIPPI中第3次出现的位置, select INSTR('Mississippi','i',5,3) from dual; select INSTR('Mississippi','i',-2,3) from dual; --返回的是字节 select INSTRB('Mississippi','i',5,3) from dual; select INSTRB('Mississippi','i',-2,3) from dual; --长度 select length('WHO ARE YOU') from dual; select nvl(null,'空') from dual; --小写 select lower('WHo are You') from dual; --LPAD左侧用字符串补足到一定长度 select LPAD('DFSDf................',9,'WHO') from dual; select LPAD('DFSD',9,'WHO') from dual; select LPAD('DFSD',9,'') from dual; select LPAD('DFSD',length('DFSD')+length('WHO......'),'WHO......') from dual; --把最左边的字符去掉,使其第一个字符不在其中 select ltrim('Mississippi','Mis') from dual; select ltrim('Mississippi','miD') from dual; --RPAD右侧用字符串补足到一定长度 select RPAD('DFSDf................',9,'WHO') from dual; select RPAD('DFSD',9,'WHO') from dual; select RPAD('DFSD',9,'') from dual; . . . . . . .