The GET_LINE procedure reads data from a file starting at the offset where the file was last read, based on the input file handle and read length. It stops when it encounters a newline character.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
UTL_FILE.GET_LINE (
file IN FILE_TYPE,
buffer OUT VARCHAR2,
len IN PLS_INTEGER DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| file | The file handle for the file to be read. The file must be opened in r mode. |
| buffer | An output parameter used to store the read data. The length of this string must be greater than the len parameter. |
| len | The number of bytes to read. If not specified, the system will use the max_linesize parameter from when the file was opened. |
Exceptions
INVALID_FILEHANDLEINVALID_OPERATIONNO_DATA_FOUNDREAD_ERROR
Considerations
The file must be opened in
rmode; otherwise, anINVALID_OPERATIONexception will be raised.If the line cannot fit into the buffer, a
READ_ERRORexception will be raised. If the end of the file is reached without reading any text, aNO_DATA_FOUNDexception will be raised. If the file is opened in byte mode, anINVALID_OPERATIONexception will be raised.Since line terminators are not read into the buffer, reading an empty line will return an empty string.
If the maximum byte count is not specified in
FOPEN, the buffer parameter can be up to 32767 bytes. The default value is 1024.
