EMPTY_CLOB

EMPTY_CLOB() is a function in SQL that is used to initialize a CLOB or NCLOB column to empty in an INSERT or UPDATE statement. This function requires no parameters and it returns a CLOB or NCLOB with a length of zero.

Example

DECLARE
empty_clob_var CLOB;
BEGIN
empty_clob_var := EMPTY_CLOB();
DBMS_OUTPUT.PUT_LINE('CLOB length is: ' || DBMS_LOB.GETLENGTH(empty_clob_var));
END;
/

Output

CLOB length is: 0

Explanation

The EMPTY_CLOB() function creates a temporary CLOB with a length of 0. The DBMS_LOB.GETLENGTH function then retrieves the length of this CLOB, which, as outputted, returns 0.

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