oracle中的字符型函数

来源:互联网 发布:ping涉及到的网络协议 编辑:程序博客网 时间:2024/05/16 19:16


1.字符型函数 
select lower('ABC') from dual;转化为小写
select lower(ename) from scott.emp;
select upper('abcse') from dual;转化为大写
select upper(ename) from scott.emp;
select initcap('we rea good HELL') from dual;首字母答谢,其余小写
select concat('we are','good students') from dual;把两个字符串连接到一起
select substr('we are good student!',2,4) from dual;从第2个字符截取4个字符
select length('we are ready to study!') from dual;统计字符串
select instr('we are my students','s') from dual;查询字符s出现的位置。
select trim('?' from '?SQL*PLUS is the SQL implementation used in an Oracle RDBMS') from dual;(从两端去掉要删除的字符)
select trim(trailing 's' from 'sadasds') from dual;删除指定右面的字符
select replace('select * from studnet','select','hell') from dual;替换指定字符
select concat(ename,job) from emp;使用concat串接字符串函数查询emp表
select nullif(20,20) from dual;查询nullif中的两个值是否相等,若相等,则返回null,常用于pl/sql块中的判断









原创粉丝点击