saving the htp buffer to a file [message #48022] |
Tue, 12 October 2004 12:27 |
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 #649200 is a reply to message #649198] |
Thu, 17 March 2016 04:35 |
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 #649290 is a reply to message #649193] |
Mon, 21 March 2016 08:20 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
VPeksova wrote on Thu, 17 March 2016 04:49The 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.
|
|
|