I have to read a file via external table but this file it\'s located into another directory inside the ACFS. As first step I have to move the file So, I decided to use the prepr
The documentation doesn't explicitly say so, but yes, the file has to already exist. The concept is to preprocess the specified file, not to perform an arbitrary action before the load starts.
The argument passed to the preprocessor script is the full operating system path to the file, so Oracle is constructing that from the directory object's path and the location file name - and presumably checking that it exists before doing anything else.
As you've seen, you can work around this by pointing the location to a dummy file, and have the preprocessor script do all the work - it doesn't even need to copy the file into the right directory, as long as it ends up cat'ing it. (Whether that's a good idea is another matter; make sure you've paid attention to the security warnings around this feature).
You do have to cat the file though:
The preprocessor program converts the data to a record format supported by the access driver and then writes the converted record data to standard output (stdout), which the access driver reads as input.
One of the examples in the documentation is using zcat
to uncompress a file - to standard output; it wouldn't make sense for it to end up looking at the original file name (which will still be the compressed file).
Quote from article:
Preprocessor program must stream the input data directly to the external table—and not create another input file
Preprocessor with external table