1. nvl

NVL函数的格式如下:NVL(expr1,expr2)

含义是:如果oracle第一个参数expr1为空,那么显示第二个参数的值为expr2,如果第一个参数的值expr1不为空,则显示第一个参数本来的值。

2. nvl2

NVL2函数的格式如下:NVL2(expr1,expr2, expr3)

含义是:如果该函数的第一个参数expr1不为空,那么显示第二个参数的值为expr2,如果第一个参数expr1的值为空,则显示第三个参数的值为expr3

3. 转换函数

3.1  to_char()[将日期和数字类型转换成字符类型]

日期转换成字符类型:

select to_char(sysdate) s1,
to_char(sysdate,'yyyy-mm-dd') s2,
to_char(sysdate,'yyyy') s3,
to_char(sysdate,'yyyy-mm-dd hh12:mi:ss') s4,
to_char(sysdate, 'hh24:mi:ss') s5,
to_char(sysdate,'DAY') s6
from dual;

数字转换成字符类型:

select sal,to_char(sal,'$99999') n1,to_char(sal,'$99,999') n2 from emp

3.2  to_date()[将字符类型转换为日期类型]

insert into emp(empno,hiredate) values(8000,to_date('2004-10-10','yyyy-mm-dd'));

3.3  to_number() 转换为数字类型

select to_number(to_char(sysdate,'hh12')) from dual; //以数字显示的小时数

4. 连接运算符||

select 'hello'||'world' from dual

输出结果是:helloworld

oracle的常用函数的更多相关文章

  1. Oracle数据库常用函数

    Oracle常用函数: 20.COS返回一个给定数字的余弦SQL> select cos(-3.1415927) from dual;COS(-3.1415927)--------------- ...

  2. Oracle 之 常用函数

    SQL语句根据参数的不同,分为单行函数 和 多行函数. [1] 单行函数:输入是一行,输出也是一行: [2] 多行函数:输入多行数据,输出一个结果. 在执行时,单行函数是检索一行处理一次,而多行函数是 ...

  3. 【Oracle】常用函数

    来源自:https://www.cnblogs.com/lxl57610/p/7442130.html Oracle SQL 提供了用于执行特定操作的专用函数.这些函数大大增强了 SQL 语言的功能. ...

  4. Oracle开发常用函数与存储过程

    create or replace function Fuc_Get_AuthorName(RecID_In in varchar2, AdmID_In in varchar2) return var ...

  5. [转载]oracle的常用函数 instr() 和substr()函数

    在Oracle中 可以使用instr函数对某个字符串进行判断,判断其是否含有指定的字符. 在一个字符串中查找指定的字符,返回被查找到的指定的字符的位置. 语法: instr(sourceString, ...

  6. oracle的常用函数 instr() 和substr()函数

    from:http://1055592535.iteye.com/blog/1676235 在Oracle中 可以使用instr函数对某个字符串进行判断,判断其是否含有指定的字符. 在一个字符串中查找 ...

  7. oracle中常用函数

    1.oracle中 trunc 是截取的函数,用在日期类型上,就是截取到的日或时间. select trunc(sysdate) from dual   默认是截取系统日期到日,得到 2012-12- ...

  8. Oracle数据库常用函数使用--持续更新中

    NVL函数.NVL( string1, replace_with).如果string1为NULL,则NVL函数返回replace_with的值,否则返回原来的值. INSTR函数.用于查找指定字符串是 ...

  9. ORACLE时间常用函数(字段取年、月、日、季度)

    TO_DATE格式 Day: dd number 12 dy abbreviated fri day spelled out friday ddspth spelled out, ordinal tw ...

随机推荐

  1. Android Broadcast Receiver 使用入门

    Broadcast Receiver 的使用        1.Broadcast Receiver简介        2.Broadcast Receiver接收系统自带的广播        3.自 ...

  2. [codeforces 241]A. Old Peykan

    [codeforces 241]A. Old Peykan 试题描述 There are n cities in the country where the Old Peykan lives. The ...

  3. HDU 1707 简单模拟 Spring-outing Decision

    Spring-outing Decision Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  4. Linux upstart启动方式详解

     Ubuntu从6.10开始逐步用Upstart()代替原来的SysVinit进行服务进程的管理.RHEL(CentOS)也都从版本6开始转用Upstart代替以往的init.d/rcX.d的线性启动 ...

  5. HDOJ 2544

    最短路 Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis ...

  6. Android Debugging

    Debugging methods for Android Contents [hide]  1 Debuggers 1.1 Kernel and User co-debug with GDB on ...

  7. VIM替换、截取及追加操作

    参考: http://blog.csdn.net/love__coder/article/details/6739670 http://blog.csdn.net/love__coder/articl ...

  8. ali2015校园招聘笔试大题

    [本文链接] http://www.cnblogs.com/hellogiser/p/ali-2015-questions.html 1. 写一个函数,输入一个二叉树,树中每个节点存放了一个整数值,函 ...

  9. svn 切换默认用户名

    2015年1月19日 15:37:30\ 原文: http://www.2cto.com/os/201307/229325.html linux svn切换用户   1. 临时切换   在所有命令下强 ...

  10. delphi提示“Undeclared_identifier”的缺少引用单元列表

    _Stream ADODB_TLB akTop, akLeft, akRight, akBottom Controls Application (the variable not a type) Fo ...