oracle 常用字符串函数
select initcap('guodongdong') from dual; /返回字符串并将字符串的第一个字母变为大写;
select initcap(ename) from scott.emp; /针对scott.emp表中的ename开头全部大写。
select lower(ename) from scott.emp; /针对scott.emp表中的ename名字中全部小写。
select * from scott.emp where lower(ename)='scott'; /以防scott中有大小写。
select upper(ename) from scott.emp; /针对scott.emp表中的ename名字全部大写
select length(ename) from scott.emp; /查询scott.emp表中的ename名字所占的单词个数。
select ename,substr(ename,length(ename)-2) from scott.emp /查询Scott.emp表中的ename名字最后的三个英文名称。
或者 select ename,substr(ename,-3) from scott.emp;
select concat('guo','dongdong') from dual; /CONCAT只能连接两个字符串,没有|| 强大。
select concat(ename,sal) from scott.emp; /针对scott.emp表中的名字个工资做一个连接。
select substr('guodongdong',1,5) from dual; /查询guodongdong,從左邊1-5的单词列出。
select subsrt('guodongdong',-1,5) from dual; /從右邊開始。
select subsrt('guodongdong',-1) from dual; /截取末尾;
select lpad('guodongdong',15,'*') from dual; /显示guodongdong,15表示15为,不够15为则在前方补*。
select rpad('guodongdong',15,'*') from dual; /显示guodongdong,15表示15为,不够15为则在后方补*。
select lpad(ename,length(ename)+30,'*' )from scott.emp;
select lpad (ename,length(ename)+30,'*') from scott.emp;
select rpad (lpad (ename,length(ename)+30,'*'),length(lpad(ename,length(ename) +30,'*')) +30,'*') from scott.emp;
select replace('guodongdong','d','j') from dual; /修改guodongdong,d单词全部替换为j,则是guojongjong
select trim('k' from 'gkgguodonkkgdonggg') from dual; /只要gkgguodonkkgdonggg去除指定字符的前后空格。
ltrim
rtrim
三个主要函数:ROUND,trunc,mod
1: SELECT
round(78915.67823823), 78916,小数点之后的内容直接进行四舍五入
round(78915.67823823,2), 78915.68,保留两位小数
round(78915.67823823,-2), 78900,把不足5的数据取消了
round(78985.67823823,-2), 79000,如果超过了5则进行进位
round(-15.65) ; -16
from dual;
2:截取小数,所有的小数都不进位
SELECT
trunc(78915.67823823), 78916,小数点之后的内容直接进行四舍五入
trunc(78915.67823823,2), 78915.68,保留两位小数
trunc(78915.67823823,-2), 78900,把不足5的数据取消了
trunc(78985.67823823,-2), 79000,如果超过了5则进行进位
trunc(-15.65) ; -16
from dual;
3:求模(求余数)
select mod(10,3) from dual; 得1
oracle 常用字符串函数的更多相关文章
- ORACLE 常用字符函数
ORACLE 常用字符函数1 ASCII(arg1)返回参数arg1的十进制数字表示.如果数据库设置为ASCII,则采用的是ASCII码字符.如果设置为EBCDIC,则采用的是EBCDIC字符 sel ...
- php常用字符串函数小结
php内置了98个字符串函数(除了基于正则表达式的函数,正则表达式在此不在讨论范围),能够处理字符串中能遇到的每一个方面内容,本文对常用字符串函数进行简单的小结,主要包含以下8部分:1.确定字符串长度 ...
- [转]MySQL常用Json函数和MySQL常用字符串函数
MySQL常用Json函数:https://www.cnblogs.com/waterystone/p/5626098.html MySQL常用字符串函数:https://www.cnblogs.co ...
- js进阶js中支持正则的四个常用字符串函数(search march replace split)
js进阶js中支持正则的四个常用字符串函数(search march replace split) 一.总结 代码中详细四个函数的用法 search march replace split 二.js进 ...
- Delphi常用字符串函数
Delphi常用字符串函数 一.字符转换函数1.ord(input[i])返回字符表达式 input 左端起第 I 字符的ASCII 码值.2.CHAR()将ASCII 码转换为字符.如果没有输入 ...
- Oracle常用的函数
1.常用的函数分为五大类: 字符函数.数字和日期函数.数字函数.转换函数.混合函数 2.字符函数 字符函数主要用于修改字符列.这些函数接受字符输入,返回字符或数字值.Oracle 提供的一些字符函数如 ...
- Oracle截取字符串函数和查找字符串函数,连接运算符||
参考资料:Oracle截取字符串和查找字符串 oracle自定义函数学习和连接运算符(||) oracle 截取字符(substr),检索字符位置(instr) case when then else ...
- Oracle常用单行函数(原创)
前言: 想把单行函数进行一个比较全面的总结,并分享给有需要的人,有不明之处还请多多指教. SQL函数:Oracle的内置函数,包括了单行函数和多行函数,本文重点讲解单行函数.单行函数又可以分为许多类, ...
- MySQL最常用字符串函数
字符串函数 是最常用的的一种函数,在一个具体应用中通常会综合几个甚至几类函数来实现相应的应用: 1.LOWER(column|str):将字符串参数值转换为全小写字母后返回 mysql> sel ...
随机推荐
- Leetcode118_Pascal's Triangle_Easy
Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's t ...
- hihoCoder 1116 计算(线段树)
http://hihocoder.com/problemset/problem/1116 题意: 思路: 用线段树解决,每个节点需要设置4个变量,sum记录答案,all记录整个区间的乘积,pre记录该 ...
- 彻底弄懂JS事件委托的概念和作用
一.写在前头 接到某厂电话问什么是事件代理的时候,一开始说addEventListener,然后他说直接绑定新的元素不会报dom不存在的错误吗?然后我就混乱了,我印象中这个方法是可以绑定新节点的 ...
- P1031 均分纸牌
题目描述 有N堆纸牌,编号分别为 1,2,…,N1,2,…,N.每堆上有若干张,但纸牌总数必为N的倍数.可以在任一堆上取若干张纸牌,然后移动. 移牌规则为:在编号为1堆上取的纸牌,只能移到编号为2的堆 ...
- 启动tomcat 报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
[root@localhost META-INF]# systemctl start tomcat Job for tomcat.service failed because the control ...
- JSON parse error: Cannot deserialize instance of `int` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc
代码程序: @PostMapping("selectById") @ResponseBody public Result selectById(@RequestBody int i ...
- tomcat热部署.class
本人是在维护公司系统时遇到的问题,由于公司的系统是部署到客户服务器上,而系统中存在的问题又比较多,需要经常维护.如果每次修改完class文件后都需要去重启服务器, 那会给用户的使用造成不便,所以需要使 ...
- django人类可读性
一些Django的‘奇技淫巧’就存在于这些不起眼的地方. 为了提高模板系统对人类的友好性,Django在django.contrib.humanize中提供了一系列的模板过滤器,有助于为数据展示添加“ ...
- win7下配置Tomcat
1.下载tomcat 2.添加系统环境变量,我的电脑->属性->高级系统设置->环境变量 (1)变量名: CATALINA_BASE 变量值: D:\Program File ...
- xlua修复C#的委托事件的时候,需要提前做好配置
如下所示: //C#静态调用Lua的配置(包括事件的原型),仅可以配delegate,interface [CSharpCallLua] public static List<Type> ...