TO_NCLOB

TO_NCLOB is a conversion function in SQL that converts a LOB value from the national character set to NCLOB datatype.

TO_NCLOB( input_string IN VARCHAR2 CHARACTER SET ANY_CS ) RETURN NCLOB CHARACTER SET ANY_CS;

  • input_string in varchar2 character set any_cs: This is the string argument that is to be converted into NCLOB data type. The input string must be of VARCHAR2 data type and can contain characters in any character set.
  • return nclob character set any_cs: This signifies the character set of the return type NCLOB. Once the conversion from VARCHAR2 to NCLOB has been done, the result will have this specified character set.

Example

SELECT TO_NCLOB('Hello, Oracle!') AS "String to NCLOB"
FROM dual;

Output

String to NCLOB
-----------------
Hello, Oracle!

Explanation

This example demonstrates transforming string data to the NCLOB data type, while working with an Oracle database. The TO_NCLOB() function converts a string or LOB into the national character LOB. Here, the plain string ‘Hello, Oracle!’ is converted to an NCLOB object and selected from the pseudo-table dual.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.