TEXT_IO


Declare
in_file Text_IO.File_Type;
linebuf VARCHAR2(200);
Begin
in_file := Text_IO.Fopen('f:\test.txt', 'r');

LOOP
Text_IO.get_Line(in_file,linebuf);
:block3.text_item5:=linebuf;
    --TEXT_IO.PUT_LINE ('opened the file.');
        --TEXT_IO.PUT_LINE (in_file, 'ABC');
message(linebuf);
-- Do your things here
END LOOP;
exception
when no_data_found then
message('no data');
when others then
message('others');
END;

TEXT_IO.PUT_LINE ('c:\name.txt');
    text_file := TEXT_IO.FOPEN ('c:\name.txt','W');
    TEXT_IO.PUT_LINE ('opened the file.');
    TEXT_IO.PUT_LINE (text_file, 'ABC');
    TEXT_IO.PUT_LINE ('data to the file.');
   
    TEXT_IO.FCLOSE (text_file);
    TEXT_IO.PUT_LINE ('closed.');
=====================================
   
declare
     text_file TEXT_IO.FILE_TYPE;
     V varchar2(100);
BEGIN
    --TEXT_IO.PUT_LINE ('f:\test.txt');
    --text_file := TEXT_IO.FOPEN ('f:\test.txt','R');
    --TEXT_IO.GET_LINE (text_file,V);
    --MESSAGE(V);
    text_file := TEXT_IO.FOPEN ('f:\test.txt','W');
    TEXT_IO.PUT_LINE (text_file,:block3.text_item5);
    --TEXT_IO.NEW_LINE (text_file, 'AB');
    --text_file := TEXT_IO.FOPEN ('f:\test.txt','W');
    --TEXT_IO.GET_LINE (text_file, V);
    --MESSAGE(V);
        TEXT_IO.FCLOSE (text_file);
    text_file := TEXT_IO.FOPEN ('f:\test.txt','R');
    loop
    TEXT_IO.GET_LINE (text_file,V);
    MESSAGE(V);
    MESSAGE(V);
    end loop;
    TEXT_IO.FCLOSE (text_file);
    /*
    text_file := TEXT_IO.FOPEN ('f:\test.txt','W');
    TEXT_IO.PUT_LINE (text_file,'opened the second file.');
    --TEXT_IO.NEW_LINE (text_file, 'AB');
    --text_file := TEXT_IO.FOPEN ('f:\test.txt','W');
    --TEXT_IO.GET_LINE (text_file, V);
    --MESSAGE(V);
    TEXT_IO.FCLOSE (text_file);
    text_file := TEXT_IO.FOPEN ('f:\test.txt','R');
    TEXT_IO.GET_LINE (text_file,V);
    MESSAGE(V);
    TEXT_IO.FCLOSE (text_file);
    --TEXT_IO.PUT_LINE ('closed.');
    --TEXT_IO.PUT_LINE ('closed.');
    */
EXCEPTION

    when no_data_found then
message('no data');
--when others then
--message('others');
    WHEN others THEN
    TEXT_IO.PUT_LINE ('Some other error occurred.');
END;

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন