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

TEXT_IO.FOPEN built-in function

This function opens the designated file in the specified mode.

Syntax


FUNCTION TEXT_IO.FOPEN
 (spec VARCHAR2,
   filemode VARCHAR2)
 RETURN TEXT_IO.FILE_TYPE;

Parameters

Parameter

Description

spec

A case-insensitive string corresponding to a file's name.

filemode

A single case-insensitive character that specifies the mode in which to open the file, and consists of one of the following characters:

R Open the file for reading only.

W Open the file for reading and writing after deleting all existing lines in the file.

A Open the file for reading and writing without deleting existing lines (that is, appending).

Returns

A handle to the specified file.

Example


 /*
  ** Declare two local variables to represent two files:
  ** one to read from, the other to write to.
  */
  in_file TEXT_IO.FILE_TYPE;
  out_file TEXT_IO.FILE_TYPE;
  in_file := TEXT_IO.FOPEN('salary.txt', 'r');
  out_file := TEXT_IO.FOPEN('bonus.txt', 'w');

See also

About the TEXT_IO built-in package

TEXT_IO built-in package