zoukankan      html  css  js  c++  java
  • oracle常用字符函数

    字符函数:

    concat:(字符连接函数)

    --字符连接
    select concat('con','cat') from dual;
    select 'co'||'nc'||'at' from dual;

    initcap:(首字符大写)

    --首字符大写
    --其余全部小写 select initcap(
    'initCAP') from dual;

    instr:(字符串查找)

    --字符串查找
    --参数1:被查找的字符串
    --参数2:要查找的字符串
    --参数3:查找的其实位置
    --参数4:第几次出现 select instr(
    '31415926535','926') from dual;

    upper、lower:(字符串大小写)

    --字符串大小写
    select upper('upper'),lower('LOWER) from dual

    lpad、rpad:(字符左右补充)

    --字符补充函数
    --参数1:原字符串
    --参数2:补充后达到的个数
    --参数3:补充的字符
    select rpad('11',10,'*') from dual;
    select lpad('11',10,'*') from dual;

    ltrim、rtirm:(字符左右删除)

    --字符删除函数
    --参数1:要进行删除的字符串
    --参数2:从字符串的左/右删除指定的字符参数2,第二个参数省略则删除空格 select ltrim(
    ' rtrim') from dual; select rtrim('11******','*') from dual; select ltrim(rtrim('***11****','*'),'**') from dual;

    substr:(截取字符串)

    --截取字符串
    --参数1:原字符串
    --参数2:选择开始的下标,从1开始
    --参数3:选取的个数 select substr(
    '31415926535',3,8) from dual;

    replace:(替换字符串)

    --替換字符串
    --参数1:原字符串
    --参数2:需要替换的字符
    --参数3:替换成的内容 select replace(
    '**字符串','**','替换') from dual;

    trim:(去除空格)

    --去除空格
    --参数1:删除的字符,如果和from一块省略则删除两边的空格
    --参数2:进行操作的字符串 select trim(
    ' 111 ') from dual; select trim('*' from '****111****') from dual;
    --leading从左边开始删除,trailing从右边删除,both默认方式,从两边删除 select trim(leading
    '*' from '**$$111') from dual; select trim(trailing '*' from '111**') from dual; select trim(both '1' from '111*111') from dual;
  • 相关阅读:
    02-35 scikit-learn库之支持向量机
    C#当中的out关键字(借鉴于CSDN)
    Uploadify上传大文件
    EF-基础用法
    第一节:EasyUI样式,行内编辑,基础知识
    Compute和Linq的Field使用
    leetcode-15. 三数之和-OK
    C#启动时全屏显示窗体...
    C#启动时全屏显示窗体...
    leetcode-1117. H2O 生成
  • 原文地址:https://www.cnblogs.com/duguangming/p/10820226.html
Copyright © 2011-2022 走看看