I had a requirement to store Flat Files dynamically along with the current time-stamp attached with filename. When I searched through, didn’t find any specific material for the same. So now, As I’ve implemented it, I’de like to share the process with you 🙂
- Create a Flat File Format provide the location in Root directory where you want to store the file. Leave file name empty here.
- Now in your job – Create a global variable e.g. $G_File_Name. Then take a script before the DF and write the below code in Script –
‘$G_File_Name = YourFileName_’||TO_CHAR(sysdate(),’MMDDYYYY’)||’_’||TO_CHAR(sysdate(),’HHMISS’)||’.’||’txt’;’
Note: You can change the file extension as per requirement. e.g. ‘.csv’ or ‘.txt’
- Assign this global variable ‘$G_File_Name’ as file name to flatfile format in your dataflow where you are using the flat file as Target.
- So every time you run the job it will create a file with Filename along with the current timestamp attached to it.
e.g. In our case it will generate a file as ’YourFileName_11302015_021745.txt’.