We know that in the database, the Chinese character occupies two bytes, while the other characters occupy a byte, so the comparison of two functions can determine whether there is Chinese,
Length calculates character lengths, LENGTHB calculates byte lengths;
Select LENGTHB (' A Love China '), Length (' A Love China ') from dual;
The first one returns 7, and the second returns 4, which makes it possible to determine the Chinese language.
Another method using the ASCII method
oracle--Determine if the field is Chinese
On the internet to find a way to implement, try it is OK, the following statement can be found with Chinese characters in a field record
Oracle_sql Code SELECT * FROM A where ASCIISTR (a) Like '%\% ' and InStr (A, ' \ ') <= 0;
SELECT * from A where ASCIISTR (a) Like '%\% ' and InStr (A, ' \ ') <= 0;
Character function Asciistr function: Returns the ASCII code corresponding to the character, converting non-ASCII code to Unicode and preceding symbol ' \ '
The format of the InStr method is
INSTR (source string, target string, start position, match ordinal)
For example: INSTR (' CORPORATE FLOOR ', ' or ', 3, 2), the source string is ' CORPORATE FLOOR ', the target string is ' OR ', the starting position is 3, and the position of the 2nd match is taken.
The default lookup order is left to right. When the starting position is a negative number, start looking from the right.
So
Oracle_sql Code SELECT INSTR (' CORPORATE FLOOR ', ' OR ',-1, 1) "Instring" from DUAL
Select INSTR (' CORPORATE FLOOR ', ' OR ',-1, 1) "Instring" from DUAL
The display result is
Instring
——————
14