Current Position:Home > Creating text file from SQL with adding counter in Filename.

Creating text file from SQL with adding counter in Filename.

Update:10-11Source: network consolidation
Advertisement
Hi,
I have a requirement for creating the Tesxt files from Oracle DB which i can achieve by ODISQLUNLOAD.
But tricky part is that i want have a file name+ counter such that Counter should start with 1 for the first file of the day, then 2,... and reset to 1 for every new date.
e.g. file0001, file0002,file0003,file0004,.... file0100 and so on for one day.
But when i will create a file on next day it should be created as again file0001, file0002,file0003,file0004,.... file0100 and so on.
I may be able to achieve this using some variables but unable to think how could i achieve this.
Any help would be appreciated.
Thanks and Regards,
Mahesh

The Best Answer

Advertisement
Hi Mahesh,
If the files are loaded as one batch process, for instance, by executing a single package, you could perform a looping function and store the counter as a variable. It would be very similar to the blog post here: https://blogs.oracle.com/dataintegration/entry/using_variables_in_odi_creatin - but you would be using the #counter variable in your filename. Each day that the package is run, the counter starts at 1.
Hope this will fit your needs.
Enjoy!
Michael R.
  • Creating text file from SQL with adding counter in Filename. Update:10-11

    Hi, I have a requirement for creating the Tesxt files from Oracle DB which i can achieve by ODISQLUNLOAD. But tricky part is that i want have a file name+ counter such that Counter should start with 1 for the first file of the day, then 2,... and res

  • Create text file in Database Trigger Update:11-30

    Hello, How to create text file in the database trigger. I am working on Row level trigger which has select statement if statement fails I have to create text file and insert record in text file. I tried to use file1 TEXT_IO.FILE_TYPE package it does

  • Creating text file from table Update:10-11

    Hi all I have a table LFA1 with headers LIFNR, MANDT, NAME1, NAME2, ...., . That table contains data and I need to create text file that collects all headers with all data, where each field is separated by TAB. thanks for your help.Here is program fo

  • Problem in creating text file from report file Update:10-11

    Hello Everybody... I have problem in creating text file. I had set System Parameter as below DESTYPE : File MODE : Character DESNAME : gayu.txt And ruler setting Units : Character Cells Character Cell Size : Horiziontal = 7 Vertiacle =12 GridSpacing

  • How to create text file of report in 10g Update:11-30

    Hi, I want to create text file of report in character mode and print that text file, without view it on screen. i want to do this in Oracle developer 10g and run this report on web. what coading i required to do for this pls. help me.Hello, Execute t

  • How to create text file like this? Update:11-30

    I want to create text file like attached file. I thought to create 2 text file: First text file make the headers ( Position, value 0,value 1....) , Second file make the table of data. Then combine them to be third text file. Someone can post other so

  • Down load or create text file using bapi Update:11-30

    hi friends, My requirement is to create text file or down load text file in presentation server when the bapi runs in which the ip address is defined at the interface. plz sujjest me, points will be rewarded . prasad.Hi, The FM 'GUI_DOWNLOAD' should

  • Seeking simple example pl/sql to create text file from table data Update:10-11

    hello, I am hoping someone can provide very simple example of creating a file on my local harddrive using a pl/sql program. The basic steps are as follows: First, I store some text in a varchar2 variable like this: 1. select sometext into otextvar fr

  • Can we store procedure in a folder in text file using SQL QUERY Update:10-11

    I want to create a folder in D drive and give folder name as current date. After that create no. of text files based on how many procedure are,  text file name will be same as procedures name and insert a procedures inside the text files by using sto

  • Importing schema+ data using a text file containing sql commands Update:10-11

    I have the 2012 SQL SVR Mgmt Studio installed. I received a file--snippet below... from an export of our current DB provider, Advantage. I know I have to edit a lot of commands, but my question is quite simple--how do I use a text file with commands