Oracle常用函数

作者: weiyu_you | 来源:发表于2018-09-06 22:31 被阅读18次

浮世三千,吾爱有三;日、月与卿;日为朝,月为暮,卿为朝朝暮暮。

常用函数

lower:把大写转小写,主要是将表中的数,主要是将表中的数据进行转换小写,再去做比较。
upper:把小写转大写;

select * from scott.emp where ename='SMITH';
select * from scott.emp where lower(ename)='smith';

INITCAP:使字符串中的所有单词的首字母变成大写;

select INITCAP('sql course') from dual;

CONCAT:连接两个字符串;

select concat('Hello','World') from dual;

SUBSTR:取子字符串,从start开始,取count个。

select substr('HelloWorld',1,3)  from dual;

取子字符串,从4开始取到末尾

select substr('HelloWorld',4)  from dual;

LENGTH:返回字符串的长度;

select length('HelloWorld')  from dual;

INSTR(string,char):在一个字符串中搜索指定的字符,,返回发现指定的字符的位置,从1开始;

select INSTR('HelloWorld','l')  from dual;

TRIM:删除首尾的空字符串

select trim('  HelloWorld  ') from dual;
select length('  HelloWorld  ') from dual;
select length(trim('  HelloWorld  ')) from dual;

REPLACE('string','s1','s2'):string 希望被替换的字符串或变量,s1 需要被替换的字符串,s2替换的字符串

select REPLACE('HelloWorld','ll','FF') from dual;

ROUND数值函数,四舍五入

select Round(45.926,2) from dual;

TRUNC:截断

select TRUNC(45.926,2) from dual;

MOD:取模

select  MOD(1600,300)  from dual;

SYSDATE查询系统时间

SELECT SYSDATE FROM dual;

相关文章

  • Oracle常用函数

    浮世三千,吾爱有三;日、月与卿;日为朝,月为暮,卿为朝朝暮暮。 常用函数 lower:把大写转小写,主要是将表中的...

  • Oracle 常用函数

    Oracle 函数概述 函数的左右 方便数据的统计。 处理查询结果。 函数分类 内置函数数值函数字符函数日期函数转...

  • 常用 Oracle 函数

    1、流程控制函数   主要作用:将查询结果翻译成其他值(即以其他形式表现出来)  使用方法:   其中column...

  • SYSDATE, NOW等“误区”-Oracle, Postgr

    Oracle中最常用的时间类型:SYSDATE Oracle内建了时间类型sysdate,以及时间函数curren...

  • Oracle常见函数(一)

    1、Oracle函数 1.1、常用的单行函数 1.2、日期 Oracle中,时间和日期是一起存储的,其数据类型是d...

  • Oracle-常用函数

    1.to_char:将时间或数字转为字符串 to_char处理数字:TO_CHAR(number,'格式') to...

  • ORACLE-常用函数

    【一】、Oracle常用的统计函数 【二】、group by与统计函数 使用上面介绍的函数时可以使用也可以不使用g...

  • oracle常用函数介绍

    lpad(str,number1,char) 向左填充,lpad = left + padding, Except...

  • Oracle常用函数总结

  • oracle(二)函数、多表查询、结果集、伪列

    单行函数 概述 oracle数据库中,内置了很多常用的函数,整体分为: 单行函数字符函数日期函数数字函数 转换函数...

网友评论

    本文标题:Oracle常用函数

    本文链接:https://www.haomeiwen.com/subject/dsmfgftx.html