Attention:If String2 is not found in String1, the InStr function returns 0.Example:SELECT InStr (' Syranmo ', ' s ') from dual; --Return 1SELECT InStr (' Syranmo ', ' RA ') from dual; --Return 31 SELECT InStr (' Syran Mo ', ' a ', up to) from dual; --Return 0In OracleYou can use the
into test values('CA-CA1344-A-11OCT141250-D');insert into test values('JD-JD693-A-11OCT141105-D');
Iv. query results:
Method 1:
select substr(name,instr(name,'-',1)+1,instr(name,'-',instr(name,'-',1)+1)-instr(name,'-',1)-1) from test;
Method 2:
select substr(name,instr(name
An example of the character location (instr) retrieved by the oracle character truncation (substr) is as follows: substrinstr
I. Theory
Oracle truncation character (substr), search character location (instr) case when then else end statement use favoritesCommon functions: substr and instr1. SUBSTR (string, start_position, [length]) returns a substring.Explanation: string metacharactersStart_position start p
The Instr function in Oracle is used in the project. By the way, I learned this knowledge carefully. In Oracle, you can use the Instr function to determine whether a string contains specified characters. Its syntax is: Instr (string, substring, position, occurrence), where string: represents the source string; s
The Instr
The use of InStr functions in MySQL
INSTR (field name, String)This function returns the position of the string in the contents of a field, returns 0 if no string is found, or returns the position (starting at 1)SELECT * from Tbltopic ORDER by INSTR (Topictitle, ' ha ') > 0 DESCSELECT INSTR (topictitle,
PLSQL _ basic Series 1 _ Regular Expression REGEXP_LIKE/SUBSTR/INSTR/REPLACE, plsqlregexp_like
2014-11-30 BaoXinjian
I. Summary
There are four functions that support regular expressions in ORACLE:
1 REGEXP_LIKE: similar to LIKE
2 REGEXP_INSTR: similar to INSTR
3 REGEXP_SUBSTR: similar to SUBSTR
4 REGEXP_REPLACE: similar to REPLACE
They are used in the same way as Oracle SQL functions LIKE,
in
Oracle/plsql, the
substrFunctions allows to extract a substring from a string.
The syntax for the
substrfunction is:
substr(String, start_position, [length])
Description
The string is the source string.
Start_position is the position for extraction. The position
inThe string is always 1.
The length is optional.It is the number of characters to extract. If This parameter is omitted,
substrWould return the entire string.
For example:
substr(' This is a test ', 6, 2) would return ' is '
Turn from: http://www.cnblogs.com/hellofei/archive/2010/03/25/1695363.html
InStr function and substr functionThe InStr function is used to find the nth pattern-matching string from a large object, starting at the specified position.The InStr function syntax for finding strings in internal large objects is as follows:DBMS_LOB.INSTR (Lob_loc in Blob,Pattern in Raw
Using intrinsic function instr, it can be used instead of traditional like way query, and faster.InStr function, the first parameter is a field, the second argument is the string to query, the position of the return string, the first is 1, if not found is 0.Instance:SELECT o.user_name from sys_user o WHERE INSTR (o.user_name, ' director ') >0 Find User name contains director's user,
Label:CHARINDEX functionReturns the starting position of a character or string within another string.The CHARINDEX function call method is as follows:CHARINDEX (expression1, expression2 [, Start_location])Expression1 is the character to look for in expression2, Start_location is where the CHARINDEX function begins to find expression2 in expression1.The CHARINDEX function returns an integer that is the position of the string to find in the string being searched for. If CHARINDEX does not find the
index is 0) or intercepting a string starting from the character (A + 1.For example:Substr ("abcdefg", 0); // return: abcdefg, intercepting all charactersSubstr ("abcdefg", 2); // return: cdefg, intercepting all characters starting from C
1. instr
In Oracle/PLSQL, The instr function returns the position of the string to be truncated in the source string.
Syntax:
Use the Instr () and decode () functions of Oracle for multi-condition combination of ORACLE functions
The system encounters a situation where you want to process the multi-condition combination query, using the implementation methods of the instr () and decode () functions.
The following describes the functions and syntax of instr (): (the syntax of the functi
If our project is to be migrated from Oracle to Mysql, but the instr function of MySQL can only find whether the child string is in the parent string, it cannot be searched according to the number of occurrences.Here I wrote one for migration. Of course, here I only focus on migration, and may not fully implement the details of the original function.Oracle uses the following calls several times,SQL> select instr
Tags: blog http io ar os using SP Java dataOriginal: http://www.cnblogs.com/crazyjava/archive/2012/10/31/2748202.htmlInStr (String1,string2[,start_position[,nth_appearence])String1: To find in this string.String2: The string to find in string1.Start_position: The location to look for from string1. Optional, default is 1, positive numbers are retrieved from left to right, negative numbers are retrieved from right to left.Nth_appearence: Find the first few occurrences of string2. Optional, default
In general, the following two methods are used to perform a fuzzy query on the name field of the tb table in the Oracle database: 1. select * fromtbwherenamelike
In general, the following two methods are used to perform a fuzzy query on the name field of the tb table in the Oracle database: 1. select * from tb where name like
In general, the following two methods are used to perform a fuzzy query on the name field of the tb table in the Oracle database:1. select * from tb where name like
Charindex FunctionReturns the starting position of a character or string in another string.The charindex function is called as follows:Charindex (expression1, expression2 [, start_location])Expression1 is the character to be searched in expression2. start_location is the position where the charindex function starts to find expression1 in expression2.The charindex function returns an integer that is the position of the string to be searched in the string to be searched. If charindex does not find
InStr (String,substring[,start[,occurence]])Third parameter, start the search locationThe fourth argument, the substring of the search appears several times.
such as: Select InStr (URL, ' X ', 1,2), URL from table_name where select_condition
Result: Returns the string "X" to appear in the URL for the second time: 11Note: 1.url= "ABC_DBDJX_XLJXJL_ABCD"
2.table_name and Select_condition are replaced with a
-- INSTR (source string, the string to find, starting with the first few characters, to find the ordinal number of matches) if it is not found, return 0. A bit like the Get array subscript
Select INSTR in Java (' Ni ... HA,.OWCAO,NIA,.M,.. , Bi ', ', ', 3, 2) from dual
--------------------------------------- 14
--substr (' String to intercept ', target pos
2014-11-30 BaoxinjianI. Summary
There are four main functions in Oracle that support regular expressions:1 Regexp_like: Similar to the function of like2 Regexp_instr: Similar to the function of INSTR3 Regexp_substr: Similar to the function of SUBSTR4 Regexp_replace: Similar to the function of REPLACEThey are used in the same way as Oracle SQL functions like, INSTR, SUBSTR, and replace usages.Second, call format
1. Format:regexp_instr (sour
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.