Oracle reads the corresponding fields from the XML file in the database table

Source: Internet
Author: User

Example:

Select substr (Largetext,instr (Largetext, ' a ', ") +11,instr (Largetext, ' B ',)-instr (Largetext, ' a '," -11) "as Cutstr
From table name where id= ' 123456789 '
and InStr (Largetext, ' B ', <>0;)

1.instr

Returns the position of the string to intercept in the source string, separating the common functions from the string.

InStr (string1, string2, start_position,nth_appearance)

string1 source string to find in this string.
string2 The string to find in string1.
start_position represents where string1 is starting to find. This parameter is optional if omitted by default to 1. The string index starts at 1. If this parameter is positive, it is retrieved from left to right, and if this parameter is negative, right-to-left, returns the starting index of the string to find in the source string.
nth_appearance represents the string2 to find the first occurrence. This parameter is optional, If omitted, the default is 1. If negative, the system will give an error.

2.substr

SUBSTR (string, intercept start position, intercept length)//return intercepted word

substr (' Hello World ', 0, 1)//return result is ' H ' * start with a string of length 1 from the first character

substr (' Hello World ', 1, 1)//Returns the result for ' H ' *0 and 1 is the first character that represents the start position of the Intercept

substr (' Hello world ', 2,4)//return result as ' Ello '

substr (' Hello world ', -3,3)//Returns the result as ' rld ' * negative (-i) to indicate the start of the intercept is the left number I character of the right end of the string

Test:

Select substr (' Hello world ', -3,3) value from dual

3.and InStr (Largetext, ' </CARRIERID> ') <>0; judged to have a string

Oracle reads the corresponding fields from the XML file in the database table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.