讀檔

PROCEDURE echo_file_contents IS
in_file Text_IO.File_Type;
linebuf VARCHAR2(1800);
filename VARCHAR2(30);
BEGIN
filename:=GET_FILE_NAME(’c:\temp\’, File_Filter=>’Text Files (*.txt)|*.txt|’);
in_file := Text_IO.Fopen(filename, ‘r’);
LOOP
Text_IO.Get_Line(in_file, linebuf);
:text_item5:=:text_item5||linebuf||chr(10);
END LOOP;
EXCEPTION
WHEN no_data_found THEN
Text_IO.Put_Line(’Closing the file…’);
Text_IO.Fclose(in_file);
END;

存檔


DECLARE
out_file Text_IO.File_Type;
output_patch VARCHAR2(30);
BEGIN
output_patch:=’c:\temp\test.xls’;
out_file := Text_IO.Fopen (output_patch, ‘w’);
Text_IO.Put(’new line’);
Text_IO.New_Line(out_file, 1);
EXCEPTION
WHEN OTHERS THEN
Text_IO.Fclose(out_file);
END;

arrow
arrow
    全站熱搜

    oracleD2K 發表在 痞客邦 留言(7) 人氣()