The GET_LINE stored procedure reads data of a specified length starting from the offset position where the last read ends in the file based on the input file handle and read length. The read will not be stopped by a line break.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
UTL_FILE.GET_LINE (
file IN FILE_TYPE,
buffer OUT VARCHAR2,
len IN PLS_INTEGER DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| file | The handle of the file to read. The file must be opened at least in r mode. |
| buffer | The output parameter used to store the data that is read from the file. The length of this string must be greater than the length specified by the len parameter. |
| len | The number of data bytes to read. If this parameter is not specified, the procedure reads data based on the value of the max_linesize parameter specified when the file is opened. |
Exceptions
INVALID_FILEHANDLEINVALID_OPERATIONNO_DATA_FOUNDREAD_ERROR
Considerations
The file must be opened in
rmode; otherwise, theINVALID_OPERATIONexception is thrown.If the line cannot be stored in the buffer, the
READ_ERRORexception is thrown. If no text is read because the file has ended, theNO_DATA_FOUNDexception is thrown. If the file is opened in byte mode, theINVALID_OPERATIONexception is thrown.Line terminators are not read to the buffer. Therefore, an empty string is returned when a blank line is read.
If you do not specify the maximum size in
FOPEN, the maximum size of the buffer parameter is 32,767 bytes. The default value is 1,024 bytes.