Processing all files in a directory
Now that we have a
mechanism in place to detect files, it will be important to know which files are available in order to process them. Today we may be receiving EMP001.TXT
, EMP001.TXT
, and EMP003.TXT
. Later we may receive other similar files. If the sequence of file names can easily be predicted, we can build the expected names in a variable and wait for the expected file. However if the file names are unpredictable and random, then we need to know what we have received before we can process them. This is what we will focus on within this recipe.
Getting ready
We can start from where we left off in the previous recipe and build the examples of this recipe into that package, or we can create an entirely new package. In either case, we will still need the files EMP001.TXT
, EMP002.TXT
, and EMP003.TXT
in the c:\temp
directory.
To make sure that our example is reusable, we will create a table with the following structure:
Create table FILESLIST ( BATCH_ID number...