TO_SINGLE_BYTE function v15

TO_SINGLE_BYTE returns char with all its multibyte characters converted to their corresponding single-byte characters. Char can be of data type CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The value returned is in the same data type as char.

Any multibyte characters in char that have no single-byte equivalents appear in the output as multibyte characters. This function applies if your database character set contains single-byte and multibyte characters.

Examples

SELECT to_single_byte('ABC&123') FROM dual;
Output
 to_single_byte 
----------------
 ABC&123
(1 row)
SELECT octet_length('A') FROM dual;
Output
 octet_length 
--------------
            3
(1 row)
SELECT octet_length(to_single_byte('A')) FROM dual;
Output
 octet_length 
--------------
            1
(1 row)
SELECT bit_length(to_single_byte('A')) FROM dual;
Output
 bit_length 
------------
          8
(1 row)
SELECT ascii(to_single_byte('A')) FROM dual;
Output
 ascii 
-------
    65
(1 row)
SELECT to_hex(ascii(to_single_byte('A'))) FROM dual;
Output
 to_hex 
--------
 41
(1 row)
SELECT TO_SINGLE_BYTE( CHR(65313)) FROM dual;
Output
 to_single_byte 
----------------
 A
(1 row)