The FOPEN_NCHAR function is used to open a file in NCHAR mode.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
UTL_FILE.FOPEN_NCHAR (
location IN VARCHAR2,
filename IN VARCHAR2,
open_mode IN VARCHAR2,
max_linesize IN BINARY_INTEGER
) RETURN FILE_TYPE;
Parameters
| Parameter | Description |
|---|---|
| location | The path object name of the file to be opened. |
| filename | The name of the file to be opened. The filename cannot contain "/". |
| open_mode | Specifies the file opening mode. The mode can be:
a or ab for open_mode when opening a file that does not exist, the file is created in write mode. |
| max_linesize | The maximum number of bytes per line in the file, including the newline character. The value ranges from [1, 32767], with a default value of 1024. |
Return value
The function returns a file handle of the UTL_FILE.FILE_TYPE type. All subsequent read and write operations on the file must use this handle.
Considerations
- Unlike the
FOPENfunction, theFOPEN_NCHARfunction is specifically used to open a file inUnicodemode. After using this function to open a file, read and write operations on the file will use theUnicodecharacter set, not the default character set of the database. This ensures the correct storage and retrieval of wide-character data across different language environments. - Before using the
UTL_FILEpackage (includingFOPEN_NCHAR) to operate on operating system files, you must first create a correspondingDIRECTORYobject in the database and grant the necessary read and write permissions to the user.
