您的位置:首页 > 数据库 > Oracle

oracle中的字符型函数

2013-06-28 13:48 120 查看
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块中的判断
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: