Home » SQL & PL/SQL » SQL & PL/SQL » CLOB to file (Oracle 11g, Win 7)
CLOB to file [message #667342] Thu, 21 December 2017 11:27 Go to next message
Messages: 150
Registered: January 2010
Senior Member

I am having difficulty executing this code as it writes only 1 record to file.

  for rec in (select dat from temp_401_keys)
    DBMS_XSLPROCESSOR.clob2file(rec.dat, 'UTL_FILE_DIR', 'pn.txt');
   end loop;

The table has like 12 rows, but it only writes 1 record to file.

create table TEMP_401_KEYS
  dat CLOB

Attaching the rows .
  • Attachment: tmp001.csv
    (Size: 20.37KB, Downloaded 357 times)
Re: CLOB to file [message #667343 is a reply to message #667342] Thu, 21 December 2017 11:49 Go to previous message
Messages: 26757
Registered: January 2009
Location: SoCal
Senior Member
IMO, code is working 100% correct as implemented.
>DBMS_XSLPROCESSOR.clob2file(rec.dat, 'UTL_FILE_DIR', 'pn.txt');
each invocation of line above writes (or over writes) content of rec.dat to file pn.txt
CLOB2FILE does NOT append any new data to existing file.

BTW, I do not think that "tmp001.csv" is a legitimate Comma Separated Values file.
Previous Topic: LIKE Operator in MERGE
Next Topic: How to cast collection in table
Goto Forum:

Current Time: Sun Jan 24 01:33:41 CST 2021