Home » SQL & PL/SQL » SQL & PL/SQL » saving the htp buffer to a file
saving the htp buffer to a file [message #48022] Tue, 12 October 2004 12:27 Go to next message
Chuck
Messages: 9
Registered: January 2002
Junior Member
I have a procedure that uses HTP to create web pages.
I want to save the pages to a file instead of sending them to the browser.

How can I use OWA.GET_PAGE and UTL_FILE to capture a page that is more than 32k?
I can use the following procedure to capture the first 32k of a page. HOW DO I GET THE REST?
(This code is from AskTom.oracle.com):

create or replace procedure dump_page( p_dir in varchar2,
p_fname in varchar2 )
is
l_thePage htp.htbuf_arr;
l_output utl_file.file_type;
l_lines number default 99999999;
begin
l_output := utl_file.fopen( p_dir, p_fname, 'w' );

owa.get_page( l_thePage, l_lines );

for i in 1 .. l_lines loop
utl_file.put( l_output, l_thePage(i) );
end loop;

utl_file.fclose( l_output );
end dump_page;
/
Re: saving the htp buffer to a file [message #649193 is a reply to message #48022] Thu, 17 March 2016 03:49 Go to previous messageGo to next message
VPeksova
Messages: 1
Registered: March 2016
Junior Member
The problem is that UTL_FILE package has a 32k limitation for output.
Use the first part of your script for aquiring data.
Then, for writing data into a file use a java envelope for PL/SQL as described in http://www.dba-oracle.com/t_export_unload_blob_clob.htm.
Re: saving the htp buffer to a file [message #649194 is a reply to message #649193] Thu, 17 March 2016 04:04 Go to previous messageGo to next message
John Watson
Messages: 8930
Registered: January 2010
Location: Global Village
Senior Member
Welcome to the forum. Please read our OraFAQ Forum Guide and How to use [code] tags and make your code easier to read

It is very nice to see a new member whose first message is an answer, not a question! However, you did answer a question that is 12 years old with broken link.
No problem - I hope you'll continue to contribute.
Re: saving the htp buffer to a file [message #649198 is a reply to message #649193] Thu, 17 March 2016 04:30 Go to previous messageGo to next message
gazzag
Messages: 1118
Registered: November 2010
Location: Bedwas, UK
Senior Member
Your link is munged. It should be How to export/unload a BLOB/CLOB.

However, I would take most of that particular site with a large pinch of salt.
Re: saving the htp buffer to a file [message #649199 is a reply to message #649198] Thu, 17 March 2016 04:31 Go to previous messageGo to next message
gazzag
Messages: 1118
Registered: November 2010
Location: Bedwas, UK
Senior Member
Ah, good spot, John Smile
Re: saving the htp buffer to a file [message #649200 is a reply to message #649198] Thu, 17 March 2016 04:35 Go to previous messageGo to next message
John Watson
Messages: 8930
Registered: January 2010
Location: Global Village
Senior Member
The quality of posts on that website is highly variable. Some people get quite apoplectic about even mentioning it. I find that it is a useful resource, particularly for pointers to further research, but perhaps that is because I know enough to be cognizant of possible problems with the advice. One very irritating point is that they never seem to remove or update old posts, no matter how inaccurate they are in current releases.
Re: saving the htp buffer to a file [message #649202 is a reply to message #649200] Thu, 17 March 2016 05:07 Go to previous messageGo to next message
Michel Cadot
Messages: 68644
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
Some people get quite apoplectic about even mentioning it.


/forum/fa/1686/0/

Re: saving the htp buffer to a file [message #649204 is a reply to message #649202] Thu, 17 March 2016 05:22 Go to previous messageGo to next message
gazzag
Messages: 1118
Registered: November 2010
Location: Bedwas, UK
Senior Member
Laughing
Re: saving the htp buffer to a file [message #649290 is a reply to message #649193] Mon, 21 March 2016 08:20 Go to previous message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
VPeksova wrote on Thu, 17 March 2016 04:49
The problem is that UTL_FILE package has a 32k limitation for output.
Use the first part of your script for aquiring data.
Then, for writing data into a file use a java envelope for PL/SQL as described in http://www.dba-oracle.com/t_export_unload_blob_clob.htm.

You can write larger strings using UTL_FILE. Use UTL_FILE.PUT and break up the file to be written into blocks 32K or smaller. PUT does not write end of line characters. When your writting the last segment then end it with a call to UTL_FILE.NEW_LINE to insert an end of line character.
Previous Topic: Help with Function
Next Topic: regexp_substr
Goto Forum:
  


Current Time: Wed Apr 24 01:24:28 CDT 2024