PACKAGE P_WRITE IS TYPE r_xml_row IS RECORD ( xml_row VARCHAR2(32000)); TYPE t_xml_tab IS TABLE OF r_xml_row INDEX BY BINARY_INTEGER; g_client_path VARCHAR2(2000) := 'C:\temp\mydata.xml'; -- This example uses an PL/SQLTable , -- ( you can modify this example using a Cusor-loop, ...) -- You can call this example from an other program/ trigger -- ( P_WRITE.Write_data( P_WRITE.g_client_path, my_data ); ) -- you have to fill (my_data t_xml_tab;) in other program before. PROCEDURE Write_data(p_file_name IN VARCHAR2, p_data_tab IN OUT t_xml_tab); END; PACKAGE BODY P_WRITE IS PROCEDURE Write_data(p_file_name IN VARCHAR2, p_data_tab IN OUT t_xml_tab) IS file_handle text_io.FILE_TYPE; i INTEGER; l_num_rows INTEGER; BEGIN l_num_rows := p_data_tab.COUNT; IF l_num_rows > 0 THEN IF ( text_io.Is_Open( file_handle ) ) THEN text_io.FClose( file_handle ); END IF; -- first. open and close the file -- to get an empty file file_handle := text_io.fopen( p_file_name, 'W' ); text_io.FClose( file_handle ); -- append Data file_handle := text_io.fopen( p_file_name, 'A' ); -- nice if many data are to write ( not scope of this example) -- progress.prc_init('Download data...',l_num_rows,0.01,7,7); FOR i IN 1 ..p_data_tab.COUNT LOOP -- Write Data text_io.put_line( file_handle,p_data_tab(i).xml_row); -- progress.prc_go(i); END LOOP; -- progress.prc_stop; -- Close file text_io.FClose( file_handle ); -- message(p_file_name|| ' succsessfully written!'); ELSE message('No data found'); END IF; EXCEPTION WHEN OTHERS THEN -- progress.prc_stop; IF text_io.is_open(file_handle) THEN text_io.fclose(file_handle); END IF; RAISE; END Write_xml; END;