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 ...
随机推荐
- 【OJ】 : 容斥原理计算出 1< =n < 1e9 中是2,3,5倍数的整数的数量
最近ACM时遇到个题,题意如下. 问题描述: 有个1到n的数列,数一下其中能够被 2, 的时候有 ,,,,.这5个数满足条件,所以我们应该输出 5 . 输入 多组输入到文件尾,每组输入一个 n (n ...
- Pandas 基础(3) - 生成 Dataframe 的几种方式
这一节想总结一下 生成 Dataframe 的几种方式: CSV Excel python dictionary List of tuples List of dictionary 下面分别一一介绍具 ...
- strpos检测字符串是否包含元素
<?php echo strpos('https://www.baidu.com','https',0); ?> 默认的第三个参数就是0. 第三个参数表示查找的起始位置. 如果不存在的话, ...
- Eclipse调试DEBUG时快速查看某个变量的值的快捷键、快速跳转到某行的快捷键
Eclipse调试DEBUG时快速查看某个变量的值的快捷键 Ctrl + Shift + i
- prometheus的agent 二次开发代码参考
import com.codahale.metrics.MetricRegistry;import io.prometheus.client.CollectorRegistry;import io.p ...
- 基于反射实现实体DTO映射
对象类型转换还可以通过序列化和反序列化 先把一个对象序列化成字符串 然后反序列化成另外一个对象 通过表达式树 字段缓存 泛型缓存效率更高
- GridView实现拖拽排序以及数据交互
在研究项目中的一个效果的时候,查找资料过程中发现有人有这么一种需求,就是GridView在实现拖拽排序的基础上,如果是两个GridView之间实现拖拽效果,并要实现数据交互. 一.效果图: 实现这个效 ...
- R语言 让纵坐标的标签显示为横向
参考自153分钟学习R语言 坐标y 上的数字如何水平放置?仍然是绘图参数问题: ?par # see lasplot(0, 0, xaxt="n" , type="n& ...
- 批量显示QC结果的利器(转)
作者:greenhillman MultiQC homepage: http://multiqc.info功能:把多个测序结果的qc结果整合成一个报告.支持fastqc.trimmomatic.bow ...
- every day a practice —— morning(3)
"WeChat does not store any chat histories. They are stored only on users' phones, computers or ...