zoukankan      html  css  js  c++  java
  • Oracle/PLSQL: INSTR Function-from cyber

    Oracle/PLSQL: INSTR Function

    This Oracle tutorial explains how to use the Oracle/PLSQL INSTR function with syntax and examples.

    Description

    The Oracle/PLSQL INSTR function returns the location of a substring in a string.

    Syntax

    The syntax for the INSTR function in Oracle/PLSQL is:

    INSTR( string, substring [, start_position [,  nth_appearance ] ] )

    Parameters or Arguments

    string
    The string to search. string can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.
    substring
    The substring to search for in string. substring can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.
    start_position
    Optional. The position in string where the search will start. If omitted, it defaults to 1. The first position in the string is 1. If the start_position is negative, the INSTR function counts back start_position number of characters from the end of string and then searches towards the beginning of string.
    nth_appearance
    Optional. The nth appearance of substring. If omitted, it defaults to 1.

    Note: If substring is not found in string, then the INSTR function will return 0.

    Applies To

    The INSTR function can be used in the following versions of Oracle/PLSQL:

    • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
    • See also the REGEXP_INSTR function.

    Example

    Let's look at some Oracle INSTR function examples and explore how to use the INSTR function in Oracle/PLSQL.

    For example:

    INSTR('Tech on the net', 'e')
    Result: 2   (the first occurrence of 'e')
    
    INSTR('Tech on the net', 'e', 1, 1)
    Result: 2   (the first occurrence of 'e')
    
    INSTR('Tech on the net', 'e', 1, 2)
    Result: 11  (the second occurrence of 'e')
    
    INSTR('Tech on the net', 'e', 1, 3)
    Result: 14  (the third occurrence of 'e')
    
    INSTR('Tech on the net', 'e', -3, 2)
    Result: 2
  • 相关阅读:
    winget
    splunk单节点容器部署
    jumpserver容器化部署
    思科acl
    Java springboot-plus
    接口 Postman 上传图片测试
    EF 数据迁移 新
    电商 抓取淘宝分类 包含图片和名称
    思维导图 淘宝上新流程
    功能模块 上传视频 生成视频预览图
  • 原文地址:https://www.cnblogs.com/Jeffrey-xu/p/4819586.html
Copyright © 2011-2022 走看看