zoukankan      html  css  js  c++  java
  • oracle数据库中decode函数的使用

    语法

    decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值) 

    函数含义

    IF条件=值1THEN
    RETURN(返回值1)
    ELSIF条件=值2THEN
    RETURN(返回值2)
    ......
    ELSIF条件=值nTHEN
    RETURN(返回值n)
    ELSE
    RETURN(缺省值)
    ENDIF
    注意,后面的缺省值是可以不写的。
     

    select lb.contno,
    decode(cont.conttype, '1', cont.appntno, '2', cont.insuredno),
    decode(cont.conttype, '1', cont.appntname, '2', cont.insuredname),
    to_date(lb.create_time),
    to_char(lb.sum_total, '9999999990.99'),
    to_char(lb.sum_price, '9999999990.99'),
    to_char(lb.sum_tax, '9999999990.99'),
    lb.sid,
    lb.managecom
    from LIS_BUSI_TRANSACTIONS lb, lccont cont
    where cont.contno = lb.contno
    and lb.invoiceflag in ('00')
    and lb.successflag = '1'
    and not exists
    (select 1 from lcgrpcont c where c.grpcontno = lb.contno)
    and lb.sum_total > 0
    and (cont.currency = '01' or cont.currency is null)
    and not exists (select 1
    from ljagetendorse a, LIS_BUSI_TRANSACTIONS b
    where a.actugetno = b.sourceid
    and a.getflag = '1'
    and b.ruleid in ('3', '6', '10', '12')
    and a.actugetno = lb.sourceid
    and b.sid = lb.sid)

  • 相关阅读:
    pycharm快捷键
    Java线程的生命周期
    Java中的管程
    Java并发编程之入门
    Linux系统监控命令
    RT-Thread 搜集一些其他博主的博客以备学习
    late_initcall 替换 module_init
    去掉行尾的^M
    ST3 C程序自动补全
    MinGW-W64 编译 LLVM 与 Clang
  • 原文地址:https://www.cnblogs.com/dongyaotou/p/12228010.html
Copyright © 2011-2022 走看看