zoukankan      html  css  js  c++  java
  • SQL中Charindex和Oracle中对应的函数Instr

    转:http://blog.csdn.net/zhuyu19911016520/article/details/8568640

    sql :charindex('字符串',字段)>0    charindex('administrator',MUserID)>0

    oracle:instr(字段,'字符串',1,1) >0   instr(MUserID,'administrator',1,1)>0

    在项目中用到了Oracle中 Instr 这个函数,顺便仔细的再次学习了一下这个知识。

    Oracle中,可以使用 Instr 函数对某个字符串进行判断,判断其是否含有指定的字符。

    其语法为:

    Instr(string, substring, position, occurrence)

    其中

    string:代表源字符串;

    substring:代表想聪源字符串中查找的子串;

    position:代表查找的开始位置,该参数可选的,默认为 1;

    occurrence:代表想从源字符中查找出第几次出现的substring,该参数也是可选的,默认为1;

    如果 position 的值为负数,那么代表从右往左进行查找。

    返回值为:查找到的字符串的位置。

    对于 Instr 函数,我们经常这样使用:从一个字符串中查找指定子串的位置。

    例如:

    SELECT Instr('Hello Word', 'o', -1, 1) "String" FROM Dual 的显示结果是

    Instring

    ----

    8

  • 相关阅读:
    js将url转换二维码
    百度地图api使用
    js字符串转日期兼容性
    Object.keys的使用
    Web App和Native App的比较
    数组转为对象
    常用meta整理
    git merge和git rebase的区别
    GitHub 翻译之 'Hello-world' 翻译
    js数据类型
  • 原文地址:https://www.cnblogs.com/fengzhentian/p/4664571.html
Copyright © 2011-2022 走看看