Mysql will use the same language method:SELECT ' column ' from ' table ' where ' condition ' like '%keyword% 'In fact, you can use both the locate and InStr functions insteadSELECT ' column ' from ' table ' where locate(' keyword ', ' condition ') >0or locate's name position.SELECT ' column ' from ' table ' where position(' keyword ' in ' condition ')OrSELECT ' column ' from ' table ' where instr(' conditi
Usage:
INSTR (Ori_str, SUB_STR)
MySQL INSTR () finds the position of a string in another string, returning the index value of the first occurrence.
Example:1.
The code is as follows
Copy Code
Mysql> Select InStr (' Www.111cn.net ', '. ');+ —————————-+| InStr (' Www.111cn.net ', '. ') |+
As a result of today's sub-classification of a site for the SQL InStr () and locate () string operation function, below to make a note down, the need for friends can refer to.INSTR (STR,SUBSTR)Returns the first occurrence of a substring of string str. This is the same as the two-parameter form of locate (), unless the order of the arguments is reversed.
The code is as follows
Copy Code
mysql> SELECT
1:update table Name set column name = SUBSTR (column name, INSTR (column name, ' match character ', "+1") Where condition like '%*% '2:select SUBSTR (column name, INSTR (column name, ', ', +1) as D from table name T where condition like '%-% ';Example: Select INSTR (' orc+001 ', ' + ', ' a ') from dualThe return is "4" if the string has no matching character and
Common functions: Substr and InStr
1.SUBSTR (string,start_position,[length]) to substring, return string
Explanation: String Meta string
Start_position starting position (starting from 0)
Length optional, number of substrings
For example:substr ("ABCDEFG", 0); Back: ABCDEFG, intercepting all characterssubstr ("ABCDEFG", 2); Back: CDEFG, intercept all characters after starting Csubstr ("ABCDEFG", 0, 3); Back: ABC, intercept 3 characters starting from a
--substr (string, intercept start position, intercept length) = return the intercepted wordSelectSubstr'miaoying',0,1) fromDual--The returned result is: MSelectSubstr'miaoying',1,1) fromDual--The returned result is: m--description 0 and 1 both indicate that the intercept position is the first characterSelectSubstr'miaoying',-7,4) fromDual--The returned result is: iaoy--negative indicates that: 7 means starting from the right number seventh, that is, I, a string with a length of 4 --
Test database: MySQL DatabaseINSTR (STR,SUBSTR) searches for the specified character (SUBSTR) in a string (STR) and returns the position (INDEX) of the specified character;STR is searched for stringSUBSTR the string you want to searchConclusion: In the string str, the first position (index) of the string substr appears, the index is calculated starting from 1, and if it is not found, it returns 0 without returning a negative number.--查询字符串存在的情况下:SELECT INSTR
Tags: oracle mysql instrWhen a migration project is encountered, the MySQL InStr function can only find if the substring is in the parent string and cannot be found as many times as it appears.Here I wrote one myself in order to migrate. Of course, I'm only here for migration, and may not fully implement the details of the original function.Oracle uses several of the following calls,Sql>selectinstr (' Thisisbelongtoyou,butnottome. ')
, ' to ', asposfr
Common functions: Substr and InStr1.SUBSTR (String,start_position,[length]) to substring, return stringExplanation: String meta stringsStart_position start position (starting from 0)Length optional, number of substringssubstr ("ABCDEFG", 0); --Return: ABCDEFG, intercept all characters substr ("ABCDEFG", 2); --Return: CDEFG, intercept all characters after starting with C substr ("ABCDEFG", 0, 3); --Return: ABC, intercept starting from a 3 characters substr ("ABCDEFG", 0, 100); --Return: abcdefg,1
Today, I found out that the function of the functions, can find a specific character or string.
Here's a simple example I wrote:
Dim content_text,searchword_text
' Content is contents, Searchword is the text to search for
Sub Search (Content,searchword)
If INSTR (Content,searchword) > 0 Then
Response.Write ("Found")
Else
Response.Write ("Not Found")
End If
End Sub
Content_text = "Search bar collection of code and tutorials for Ahanan peacetime lea
Requirement: Splits a string that uses a delimiter connection for a fixed number of digits, such as splitting a record 215|482|850|870 into 215,482,850,870 four recordsResult: The WITH RECURSIVE statement is capable of implementing this function and
One-time modification of the closed source Entity Provider assembly to be compatible with the new EntityFramework process, assembly
After reading this article, you will know how to directly modify a DLL without the source code to remove the strong naming restrictions on the DLL, add your "friend assembly" directly on the Assembly (a special Attribute that is applied to the Assembly so that the internal type in the Assembly can be directly called by other assembly) ". Similarly, you can use this
) from dual; -- I'm a Chinese _ test select substring_index ('I am a Chinese _ test _ data',' _ ',-2) from dual; -- Test _ DATA select substring_index ('I am a Chinese _ test _ data',' _ ', 0) from dual; -- blank string select substring_index ('I am Chinese _ test _ data',' _ ', 3) from dual; -- I am Chinese _ test _ DATA
??? I will not test the combination of Chinese and English.
??? Mysql has substring_index functions. Does oracle need similar functions?I know that only substr and mysql substr
Copy Code code as follows:
function Getbot ()
' Query spider
Dim s_agent
Getbot= ""
S_agent=request.servervariables ("Http_user_agent") ' critical judgment statement
If InStr (1,s_agent, "Googlebot", 1) >0 Then
getbot= "Google"
End If
If InStr (1,s_agent, "msnbot", 1) >0 Then
getbot= "MSN"
End If
If InStr (1,s_agent, "slurp", 1) >0
Core code:Copy codeThe Code is as follows:/*** Jscript. string package* This package contains utility functions for working with strings.*/If (typeof jscript = 'undefined '){Jscript = function (){}}Jscript. string = function (){}/*** This function searches a string for another string and returns a count* Of how many times the second string appears in the first.* (Returns the number of times a substring appears in a string)* @ Param inStr The string to
Parallel Database for OLTP and OLAPJust ASurvey article on materials in parallel database products andTechnologies for OLTP/OLAP applications. It mainly covers majorCommercial/academic efforts on developing parallel DBMS to solve theEver growing large amount of relational data processing problem.Part I–parallel DBMSs1.1 Parallel Database for OLAP (SHARED-NOTHING/MPP)TeraData–teradata Home–
Class Systeminfo_cls
Public Browser, version, Platform, Issearch, Alexatoolbar
Private Sub Class_Initialize ()
Dim Agent, Tmpstr
Issearch = False
If Not IsEmpty (session ("Systeminfo_cls")) Then
TMPSTR = Split (Session ("Systeminfo_cls"), "| | |")
Browser = tmpstr (0)
Version = TMPSTR (1)
Platform = TMPSTR (2)
Alexatoolbar = TMPSTR (4)
If tmpstr (3) = "1" Then
Issearch = True
End If
Exit Sub
End If
Browser = "Unknown"
Version = "Unknown"
Platform = "Unknown"
Agent = Request.ServerVariables ("Htt
to the specified end-end string (excluding the end-end string)/method
The Public sub-cut (head,bot) ' argument is the first string, the tail string
If isget_= false Then call steal ()
If InStr (Value_, head) >0 and InStr (Value_, bot) >0 then
Value_=mid (Value_, InStr (Value_, head) +len (head), InStr (Value_, Bot
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.