加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle_071_lesson_p4

发布时间:2020-12-12 13:28:20 所属栏目:百科 来源:网络整理
导读:函数 单行函数 single-row functions 多行函数 mutilple-row functions 单行函数: 字符函数 lower 小写 如where lower(last_name)=‘HH‘; upper 大写 如where upper(last_name)=‘hh‘; 生产维护中用的比较多 initcap 首字母大写 如where initcap(last_name
函数

单行函数 single-row functions
多行函数 mutilple-row functions

单行函数:
字符函数
lower 小写 如where lower(last_name)=‘HH‘;
upper 大写 如where upper(last_name)=‘hh‘; 生产维护中用的比较多
initcap 首字母大写 如where initcap(last_name)=‘Test‘;
concat 连接 类似|| 如concat(last_name,first_name) ,只能2个参数
substr(column,4) 从左到右,默认开始位为1, 此为输出4个字符
substr(column,-5,4) 倒数第5位起,取4位输出
substr(column,4) 从第4位开始取,直到结束
instr(column,‘t‘) 找t在第几位
length(‘abc‘) 此计算输出字符长度为3
函数可嵌套,计算是从里到外的顺序

数字函数
round(45.926,2) 四舍五入,此输出45.93 ,那么如果round(-45.926) ,输出是多少呢?
trunc(45.926,2) 只保留小数点后2位,此输出为45.92
ceil(2.83) 向上取整,此输出为3,那么如果ceil(-2.83),输出是多少呢?
floor(2.83) 向下取整,此输出为2,那么如果ceil(-2.83),输出是多少呢?
mod(1600,300) 求模,即余数

日期函数
理解此图:


select sysdate from dual;

修改时间格式:alter system set nls_date_format=‘yyyy-mm-dd hh24:mi:ss‘ scope=spfile;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读