A script-enabled browser is required for this page to function properly.

TEXT_IO built-in package examples

TEXT_IO.FCLOSE built-in procedure

TEXT_IO.FILE_TYPE built-in type

TEXT_IO.FOPEN built-in function

TEXT_IO.IS_OPEN built-in function

TEXT_IO.GET_LINE built-in procedure

TEXT_IO.NEW_LINE built-in procedure

TEXT_IO.PUT built-in procedure

TEXT_IO.PUTF built-in procedure

TEXT_IO.PUT_LINE built-in procedure

Below is an example of a procedure that echoes the contents of a file. Notice that the procedure includes several calls to TEXT_IO constructs:


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);
    --TEXT_IO.NEW_LINE;
   END LOOP;
 EXCEPTION
  WHEN NO_DATA_FOUND THEN
  TEXT_IO.PUT_LINE('Closing the file...');
  TEXT_IO.FCLOSE(in_file);
 END;

See also

Built-in packages examples

About the TEXT_IO built-in package

TEXT_IO built-in package