Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Spool CLOB to file

maldrich12Jun 10 2020 — edited Jun 11 2020

Hi,

I am trying to spool a table containing at least one CLOB column to a file. My ultimate goal is to use a single script to spool any table, regardless of the number of columns. I was very close using 'set wrap off' in my script, until I noticed CLOB columns are limited to 80 characters. I thought by adding 'set long 32767', 'set longchunksize 32767' and 'set linesize 32767', it would work, but it is not. My script:

set long 32767

set longchunksize 32767

set pagesize 0

set linesize 32767

set trimspool on

set wrap off

set colsep "|"

set head off

set verify off

set feedback off

set termout off

alter session set nls_date_format = 'MM/DD/YYYY HH24:MI:SS';

spool <spool_file.txt>

select * from <tablename>;

spool off

Comments
Post Details
Added on Jun 10 2020
6 comments
6,756 views