Purpose
This function converts data of the CHAR, VARCHAR2, CLOB, or NCLOB type to the national character set and returns the data as the NVARCHAR2 data type.
Syntax
TO_NCHAR(character)
Parameters
character specifies the data of the CHAR, VARCHAR2, CLOB, or NCLOB type.
Return type
NVARCHAR2.
Examples
Create a table named tbl1 and insert data into it. Then, convert the VARCHAR2 data in the tbl1 table to the national character set.
obclient> CREATE TABLE tbl1(col1 INT,col2 VARCHAR2(20));
Query OK, 0 rows affected
obclient> INSERT INTO tbl1 VALUES(1,'OceanBase');
Query OK, 1 row affected
obclient> SELECT TO_NCHAR(col2) FROM tbl1;
+----------------+
| TO_NCHAR(COL2) |
+----------------+
| OceanBase |
+----------------+
1 row in set
