TO_CLOB

The TO_CLOB function converts one of the following values to a CLOB:

  • Character value contained in one of the following data types: CHAR, VARCHAR2, NVARCHAR2, TT_VARCHAR, TT_NVARCHAR, or NCLOB

  • Datetime value contained in a DATE or TIMESTAMP data type

  • Number value contained in a NUMBER, BINARY_FLOAT, or BINARY_DOUBLE data type

This function is not supported in TimesTen Scaleout.

SQL syntax

TO_CLOB ( ValidDataType )

Parameters

TO_CLOB has the parameters:

Parameter Description

ValidDataType

A value of one of the valid data types mentioned above.

Description

The TO_CLOB function will not operate on values contained in INTERVAL or TIMESTAMP with TIMEZONE data types.

Examples

The following example uses the TO_CLOB function to convert a string.

Command> DESCRIBE clob_content;
 
Table USER1.CLOB_CONTENT:
  Columns:
   *ID                              NUMBER (38) NOT NULL
    CLOB_COLUMN                     CLOB NOT NULL
 
1 table found.
(primary key columns are indicated with *)

Command> INSERT INTO clob_content (id, clob_column) VALUES (3, EMPTY_CLOB());
1 row inserted.

Command> UPDATE clob_content 
         SET clob_column = TO_CLOB('Demonstration of the TO_CLOB function.') 
         WHERE id = 3;
1 row updated.