Purpose
This function is used to convert all multibyte characters to their corresponding single-byte counterparts. This function only works if your database's character set contains both single-byte and multi-byte characters.
Syntax
TO_SINGLE_BYTE(char)
Parameters
char can be of type CHAR, VARCHAR2, NCHAR, or NVARCHAR2. If any multibyte character in char does not have a single-byte equivalent, it is displayed as a multibyte character in the output string.
Return type
The return value is of the same data type as char.
Examples
Convert multi-byte B values in UTF8 to single-byte B values in ASCII.
obclient> SELECT TO_SINGLE_BYTE(CHR(15711394)) FROM DUAL; +-------------------------------+ | TO_SINGLE_BYTE(CHR(15711394)) | +-------------------------------+ | B | +-------------------------------+ 1 row in setConverts fullwidth characters to halfwidth characters in a string.
obclient> SELECT TO_SINGLE_BYTE('China A') text FROM DUAL; +---------+ | TEXT | +---------+ | China A | +---------+ 1 row in set