How to free temporary lob used in result set of SQL SELECT in Oracle
Before executing DBMS_LOB.CLOSE( lob_loc =&gt; lv_clob ); you need to execute dbms_lob.FREETEMPORARY(lv_clob); 

According to the Oracle documentation it is required to free lob before closing.