Exporting a CLOB to a text file using Oracle SQL Developer

if you have access to the file system on your database box you could do something like this: CREATE OR REPLACE DIRECTORY documents AS ‘C:\’; SET SERVEROUTPUT ON DECLARE l_file UTL_FILE.FILE_TYPE; l_clob CLOB; l_buffer VARCHAR2(32767); l_amount BINARY_INTEGER := 32767; l_pos INTEGER := 1; BEGIN SELECT col1 INTO l_clob FROM tab1 WHERE rownum = 1; l_file … Read more

Java: How to insert CLOB into oracle database

The easiest way is to simply use the stmt.setString(position, xml); methods (for “small” strings which can be easily kept in Java memory), or try { java.sql.Clob clob = oracle.sql.CLOB.createTemporary( connection, false, oracle.sql.CLOB.DURATION_SESSION); clob.setString(1, xml); stmt.setClob(position, clob); stmt.execute(); } // Important! finally { clob.free(); }