zoukankan      html  css  js  c++  java
  • Oracle 常用内置函数

     1 --绝对值
     2 select abs(-134) from dual;--134
     3 --求模
     4 select mod(123,10) from dual;--3
     5 --取整
     6 select ceil(123.33) from dual;--124
     7 select floor(123.33)from dual;--123
     8 --四舍五入
     9 select round(123.45)from dual;--123
    10 select round(123.45,1)from dual;--123.5
    11 select round(126.45,-1)from dual;--130
    12 --截取
    13 select trunc(123.45)from dual;--123
    14 select trunc(123.45,1)from dual;--123.4
    15 select trunc(126.45,-1)from dual;--120
    16 
    17 --字符串长度
    18 select length('一个字符串')from dual;--5
    19 --截取
    20 select st.sname,substr(st.sname,) from student st;
    21 --替换
    22 select replace('abcde','b')from dual;--acde
    23 select replace('abcde','b','B')from dual;--aBcde
    24 --去空格
    25 select trim('  abcde  ')from dual;
    26 select Ltrim('  abcde  ')from dual;--去左空格
    27 select Rtrim('  abcde  ')from dual;--去右空格
    28 --查找字符串
    29 select instr('abcdeabcd','b')from dual;--找到返回第一个位置值 ,找不到返回0
    30 
    31 --系统当前时间
    32 select sysdate from dual;
    33 --运算
    34 select sysdate + 10 from dual;--当前日期天数增加10
    35 select sysdate - 30 from dual;--2016/5/16/15:06:02
    36 --加月份
    37 select add_months(sysdate,1)from dual;--当前月份加1
    38 --月的最后一天
    39 select last_day(to_date('2016/5/16','yyyy/mm/dd'))from dual;--查询月份的最后一天是几号
    40 
    41 --当前时间转成字符串
    42 select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;--2016-06-15
    43 select to_date('2016/5/16','yyyy/mm/dd')from dual;
    44 select * from student st where st.sbirthday > to_date('19720101','yyyymmdd');
    45 select to_number('2016.6')from dual;
  • 相关阅读:
    ue4 Windows RawInput Plugin
    UE4 VR中一种比较清晰的UI制作方式
    C# 自定义特性及反射
    C# 委托
    java+orace+hql分页
    数据库小知识总结
    往oracle数据库表中插入五十万条数据
    jsp页面传到action乱码问题
    常见数据库对象与java.sql.Types对照
    Oracle数据库初探
  • 原文地址:https://www.cnblogs.com/ouyangtangfeng99/p/5587791.html
Copyright © 2011-2022 走看看