Oracle DBMS_LOB - Write, Writeappend CLOB
-- Oracle Table - CMS_Config_Detail With CLOB and BLOB datatype Columns

Table With BLOB and CLOB Data

-- PL/SQL Code To Load CLOB Data using DBMS_LOB write and 
-- writeappend procedure.

DECLARE
 g_Clob    CLOB;

PROCEDURE insert_clob(p_type IN cms_config_detail.content_type%TYPE,
  p_text IN VARCHAR2)
 AS

BEGIN
  INSERT INTO cms_config_detail (content_type, content_clob)
  VALUES(p_type, empty_clob())
    RETURNING content_clob INTO g_clob;

  DBMS_LOB.write(g_clob, LENGTH(p_text), 1, p_text);
END;

PROCEDURE append_clob(p_text IN VARCHAR2) as
BEGIN
  DBMS_LOB.writeappend(g_clob, LENGTH(p_text), p_text);
END;

BEGIN
 insert_clob('CLOB', '<html><head><title>CLOB Data Load</title></head>');
 append_clob(' <body>CLOB Content</body></html>');
 COMMIT;
END;
/

Clob Write Append Execution

SELECT cms_id, content_type, content_clob
FROM cms_config_detail
WHERE cms_id = 24;

Clob Write Append Data


Refer - BLOB Write, Writeappend

Oracle registered trademark of Oracle Corporation.

Last Revised On: February 14th, 2013

  192