The FSEEK stored procedure adjusts the file pointer forward or backward within the file by the number of bytes specified.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
UTL_FILE.FSEEK (
file IN OUT UTL_FILE.FILE_TYPE,
absolute_offset IN PL_INTEGER DEFAULT NULL,
relative_offset IN PLS_INTEGER DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| file | The target file handle. |
| absolute_offset | The start position of the offset. Default value: NULL. |
| relative_offset | The number of bytes to move. A positive integer indicates moving forward. A negative integer indicates moving backward. |
Exceptions
INVALID_FILEHANDLEINVALID_OFFSETINVALID_OPERATIONREAD_ERROR
Considerations
You can use
FSEEKto directly read the first few lines in the file without closing and reopening the file.If the beginning of the file is reached within bytes fewer than the number of bytes specified by
relative_offset, the file pointer is placed at the beginning of the file. If the end of the file is reached within bytes fewer than the specified number of bytes, theINVALID_OFFSETexception will be thrown.The file must be opened in
rmode; otherwise, theINVALID_OPERATIONexception will be thrown.