请问ORACLE里有类似indexof,或者substring这样的函数吗,请举一个例子啊。谢谢!

解决方案 »

  1.   

    select substr('abcdefg',3,2) from dual;
    返回:cd说明:
    SUBSTR(char, m [, n])
    Returns a portion of Char, beginning at character M, N characters long.
    If M is positive, Oracle counts from the beginning of Char to find the first character.
    if M is negative, Oracle counts backwards from the end of Char.
    If N is omitted, Oracle returns all characters to the end of Char.
      

  2.   

       substr(1,2,3);
       1.origin string
       2.切割开始点(负数代表从末尾开始数起,最后一个为-1)
       3.切割数量(若未指明参数,则切割到结束,可选)
     
       select substr('abcdefg',2) from dual;   -bcdefg
       select substr('abcdefg',2,3) from dual;  -bcd
       select substr('abcdefg',-4,3) from dual;  -def
      

  3.   

    index of ====> instr(string, substring)
      

  4.   

    indexof  instr
    substring  substr
      

  5.   

    instr例:检索'RA'
    INSTR('ORAORASQL ARARA','RA') ・・・2检索第四个字符后面的第二个'RA'
    INSTR('ORAORASQL ARARA','RA',4,2) ・・・12检索后面第五个字符以前的'RA'
    INSTR('ORAORASQL ARARA','RA',-5,1) ・・・5
      

  6.   

    自己 可以试试 用PL/SQL 调函数 inStr subStr 都是有参数提示的