Purpose
The FUNCTION is used to convert all multibyte characters to corresponding single-byte characters. This function is effective only when your database character set contains both single-byte and multibyte characters.
Syntax
TO_SINGLE_BYTE(char)
Parameters
char can be of data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. If a multi-byte character in char does not have a single-byte equivalent, it is displayed as a multi-byte character in the output string.
Return type
The return value is of the same data type as the char parameter.
Examples
From multi-byte B in UTF8 to a 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 to half-width characters in the input string.
obclient> SELECT TO_SINGLE_BYTE('China A') text FROM DUAL; +---------+ | TEXT | +---------+ | China A | +---------+ 1 row in set
