zoukankan      html  css  js  c++  java
  • sql

    1.截取字符串

    mysql

    SUBSTRING_INDEX(SUBSTRING_INDEX(b.`ELEMENT_ALLPARENT_ID`,',',3),',',-1) AS deno

    oracle

    '402881e96274cd86016274cd86630000,8aaa87176415997a016421903b720034,402881e96275cee9016275d4fbdd000a'   截取,号后的32位

    select substr('402881e96274cd86016274cd86630000,8aaa87176415997a016421903b720034,402881e96275cee9016275d4fbdd000a',
    instr('402881e96274cd86016274cd86630000,8aaa87176415997a016421903b720034,402881e96275cee9016275d4fbdd000a',',',-1,1)+1,32
    )from dual

    instr(sourceString,destString,start,appearPosition).   instr('源字符串' , '目标字符串' ,'开始位置','第几次出现'
    返回目标字符串的位置   下标从1开始
    SQL> select instr('yuechaotianyuechao','ao') position from dual;
     
     POSITION
     ----------
     6
     
    从第7个字符开始搜索<br>
    SQL> select instr('yuechaotianyuechao','ao', 7) position from dual;
     
     POSITION
     ----------
     17
     
    substr( string, start_position, [ length ] )       substr('目标字符串',开始位置,长度)
          substr('This is a test', 6, 2)     would return 'is'
          substr('This is a test', 6)     would return 'is a test'
          substr('TechOnTheNet', -3, 3)     would return 'Net'
  • 相关阅读:
    golang zip 压缩,解压(含目录文件)
    c3p0参数详解
    golang协程——通道channel阻塞
    乔恩与加菲猫引发的思考
    部署bugzilla(bugzilla+apache+mysql+linux)
    新的篇章
    SQL基础2
    SQL基础1
    引用
    const 对象默认为文件的局部变量
  • 原文地址:https://www.cnblogs.com/jentary/p/11579137.html
Copyright © 2011-2022 走看看