Purpose
TO_NCHAR (character) converts data of the CHAR, VARCHAR2, CLOB or NCLOB type to the national character set and returns the NVARCHAR2 data type.
Syntax
TO_NCHAR(character)
Parameters
character can be data of the CHAR, VARCHAR2, CLOB, or NCLOB type.
Return type
The return type is NVARCHAR2.
Examples
Create the tbl1 table and insert data into the table. Convert 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