Purpose
This function converts all multibyte characters to their corresponding single-byte characters. It is only effective if your database character set contains both single-byte and multibyte characters.
Syntax
TO_SINGLE_BYTE(char)
Parameters
char can be of type CHAR, VARCHAR2, NCHAR, or NVARCHAR2. If a multibyte character in char has no single-byte equivalent, it is displayed as a multibyte character in the output string.
Return type
The return value has the same data type as the char parameter.
Examples
Converts multibyte B from UTF8 to single-byte B in ASCII.
obclient> SELECT TO_SINGLE_BYTE(CHR(15711394)) FROM DUAL; +-------------------------------+ | TO_SINGLE_BYTE(CHR(15711394)) | +-------------------------------+ | B | +-------------------------------+ 1 row in setConverts full-width characters in the string to half-width characters.
obclient> SELECT TO_SINGLE_BYTE('China A') text FROM DUAL; +---------+ | TEXT | +---------+ | China A | +---------+ 1 row in set