call getFiles('path/*.ext')
File Translator
The file translator, known by the type name file, exposes stored procedures to leverage file system resources exposed by the file resource adapter. It will commonly be used with the TEXTTABLE or XMLTABLE table functions to use CSV or XML formatted data.
Execution Properties
Name | Description | Default |
---|---|---|
Encoding |
The encoding that should be used for CLOBs returned by the getTextFiles procedure |
The system default encoding |
ExceptionIfFileNotFound |
Throw an exception in getFiles or getTextFiles if the specified file/directory does not exist. |
true (false prior to 8.2) |
Usage
getFiles
Retrieve all files as BLOBs with an optional extension at the given path.
If the path is a directory, then all files in the directory will be returned. If the path matches a single file, it will be returned.
The '*' character will be treated as a wildcard to match any number of characters in the path name - 0 or matching files will be returned.
If '*' is not used and the path doesn’t exist and ExceptionIfFileNotFound is true, then an exception will be raised.
getTextFiles
Retrieve all files as CLOB(s) with the an optional extension at the given path.
call getTextFiles('path/*.ext')
All the same files a getFiles will be retrieved, the only difference is that the results will be CLOB values using the encoding execution property as the character set.
saveFile
Save the CLOB, BLOB, or XML value to given path
call saveFile('path', value)
deleteFile
Delete the file at the given path
call deleteFile('path')
The path should reference an existing file. If the file does not exist and ExceptionIfFileNotFound is true, then an exception will be thrown. Or if the file cannot be deleted an exception will be thrown.
NOTE: Native queries - Native or direct query execution is not supported on the File Translator.
JCA Resource Adapter
The resource adapter for this translator provided through "File Data Source", Refer to Admin Guide for configuration information.