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;
  • 相关阅读:
    XAF中实现Combox属性编辑(官方)
    XAF 支持多数据库
    XAF 如何使用复合主键和复合外键
    如何禁止双击ListView记录显示DetailView?
    XAF中主从列表模式下获取当前主对象实例
    使用一个非持久字段PersistentAlias
    XAF 如何将文件存储在文件系统中而不是数据库中
    XAF中如何制作弹出窗体选择数据到ListView列表
    XAF 如何用其他线程更新对象
    XPO中 聚合函数的使用(Count,Max,Sum,Min)
  • 原文地址:https://www.cnblogs.com/duguangming/p/10820226.html
Copyright © 2011-2022 走看看