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
rajivn786
Messages: 144
Registered: January 2010
Senior Member
Hi,

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

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

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 56 times)
Re: CLOB to file [message #667343 is a reply to message #667342] Thu, 21 December 2017 11:49 Go to previous message
BlackSwan
Messages: 25856
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: Thu Feb 22 08:25:16 CST 2018

Total time taken to generate the page: 0.03248 seconds