Re: End of file

From: Marc Billiet <E.Mail_at_address.com>
Date: Wed, 23 Aug 2000 07:44:11 +0200
Message-ID: <8nvoi4$t74$1_at_vkhdsu24.hda.hydro.com>


When end-of-file is encountered, exception No_Data_Found is raised.

BEGIN
  ...Fopen...
  LOOP
    ...Get_Line...
     ...
  END LOOP;
EXCEPTION
  WHEN No_Data_Found Then

     ... Fclose...
END; Marc

cmusgrave99_at_my-deja.com wrote in message <8nualn$q7i$1_at_nnrp1.deja.com>...
>Hello
>
>I am trying to read in lines of data from a text file. I am using the
>following as a test.
>
>PROCEDURE test IS
> in_file TEXT_IO.FILE_TYPE;
> line_buf VARCHAR2(10);
> counter NUMBER(2);
>BEGIN
> in_file := TEXT_IO.FOPEN('C:\temp\test.txt', 'r');
> counter := 0;
> LOOP
> counter := counter + 1;
> EXIT WHEN counter > 11;
> TEXT_IO.GET_LINE(in_file, line_buf);
> TEXT_IO.PUT_LINE('out put line is ' || line_buf);
> IF line_buf IS NULL THEN
> TEXT_IO.PUT_LINE('line buf is null');
> END IF;
> END LOOP;
>END;
>
>How can I determine when I have hit the end of file? I have looked in
>the documentation but cannot find anything that looks like it will
>work. Any help would be appreciated. Any comments would be welcome if
>there is anything else I should be checking for.
>
>Thanks
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Wed Aug 23 2000 - 07:44:11 CEST

Original text of this message