To meet this requirement, the query number ends with 11 and cannot contain "4" from the fourth to the eighth digit. It was initially assumed that Oracle and SQL server support the same [^ 4], if I have checked a lot on the internet, it also means that it is supported. I have no effect on using it. The instr and substr functions are used to solve the problem.
Instr (string1, string2 [, start_position [, nth_appearance]): retrieves the index of the string in the specified string.
Parameter Analysis:
String1
Source string to be searched in this string.
String2
The string to be searched in string1.
Start_position
Position of string1. This parameter is optional. If omitted, the default value is 1. The string index starts from 1. If this parameter is positive, it is retrieved from left to right. If this parameter is negative, from right to left, the start index of the string to be searched in the source string is returned.
Nth_appearance
This parameter is optional. If omitted, the default value is 1. If it is negative, an error is returned.
If 0 is not found during search, the index of the searched string is returned.
Substr (string, start_position [, length]): gets the string with the specified start position and length in the string.
Parameter Analysis:
String
Source string, which must be truncated.
Start_position
The start position of the string.
Length
To intercept the string from the starting position to the end of the specified length.
The statement is actually very simple:
Select count (*) from tb_name where no like '% 11' and instr (substr (no, 4, 5), '4') <> 0
In this way, you can.