• oracle 函数


    1、截取字符串:substr(date,start,length);
    SQL> select substr(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),0,10) from dual;

    SUBSTR(TO_CHAR(SYSDA
    --------------------
    2013-03-25

    2、oracle中case语句 

    -- Create table
    create table HKB_TEST3
    (
      USER_ID     NUMBER(4),
      AGE         NUMBER(4),
      USER_NUMBER NUMBER(4)
    )

    SQL> select * from hkb_test3;
     
    USER_ID   AGE USER_NUMBER
    ------- ----- -----------
          1    12
          2    14
          3    16
          4    11
    例子:

    update hkb_test3
       set user_number = (select b.user_number
                            from (select a.user_id,
                                         case
                                           when a.age = 12 then
                                            '6'
                                           when a.age = 14 then
                                            '7'
                                           when a.age = 16 then
                                            '8'
                                           else
                                            '9'
                                         end user_number
                                    from hkb_test3 a) b
                           where b.user_id = hkb_test3.user_id);

    SQL> commit;
     
    Commit complete

    SQL> select * from hkb_test3;
     
    USER_ID   AGE USER_NUMBER
    ------- ----- -----------
          1    12           6
          2    14           7
          3    16           9
          4    11           9

  • 相关阅读:
    list(range(10))解释
    numpy.random.normal函数
    适用于Python扩展程序包的非官方Windows二进制文件
    Linux--vi/vim编辑器常用命令
    Centos Mirrors List (centos7)
    windows--redis安装
    Celery 3.x 升级至 celery 4.x(转)
    windows/linux(centos7)安装SVN
    远程获取--snmp模块(python)/snmp-cmds,easysnmp
    FileZilla客户端(OS)连接Linux
  • 原文地址:https://www.cnblogs.com/hy928302776/p/2981326.html
Copyright © 2020-2023  润新知