Home » SQL & PL/SQL » SQL & PL/SQL » WRITE BLOB INTO PDF
icon9.gif  WRITE BLOB INTO PDF [message #231724] Wed, 18 April 2007 04:49 Go to next message
gdottorini
Messages: 23
Registered: November 2006
Location: Napoli
Junior Member

Hi there,
i'm working on oracle 10g and i've a strange problem trying to write blob to a pdf file into file system.
The system is linux.
This is the "core" of my procedure

offset := 1;
buffer_size := 32000;
idfile utl_file.fopen('/mnt/mydir','myfile.pdf','w');
length := dbms_lob.getlength(blob_field);
while offset < length loop
dbms_lob.read(blob_field, buffer_size, offset, buffer);
utl_file.put_line(idfile, utl_raw.cast_to_varchar2(buffer));
offset := offset + buffer_size;
end loop;
utl_file.fflush(file => idfile);
utl_file.fclose_all;

The problem is: if i write a little pdf file (about 200 pages) everything goes on. If the file s bigger then 1400 pages, acrobat is unable to read the 100 final pages.
All the files are good because if i query the blob field (using pl/sql navigator) and paste the content in a file, acrobat is able to read it.

Thanks in advance.

Regards,
Giulio Dottorini

Re: WRITE BLOB INTO PDF [message #231728 is a reply to message #231724] Wed, 18 April 2007 04:53 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Don't use put_line (which is for text file not binary one), use put_raw.

Regards
Michel
Re: WRITE BLOB INTO PDF [message #231743 is a reply to message #231728] Wed, 18 April 2007 05:24 Go to previous message
gdottorini
Messages: 23
Registered: November 2006
Location: Napoli
Junior Member

Hi Michel,
your help was really great!! Now everything runs good.

Thanks a lot.

Bye,
Giulio
Previous Topic: why the trigger created with compile errors
Next Topic: DDL Statement Log
Goto Forum:
  


Current Time: Sat Dec 10 14:51:41 CST 2016

Total time taken to generate the page: 0.07645 seconds