Hi All,
Below is the version of my database;
Oracle Database 11g EE High Perf Release 11.2.0.4.0 - 64bit Production
I am trying to achieve below logic;
In my application I have multiple reports which needs to be written in csv/tab delimited files. For which, instead of writing those files to application and then transferring it to end user, I am preferring that let files written on database server through UTL_FILE. I am able to write the same, but as there are many reports so I have multiple queries for each of them, thus I want to avoid writing procedures/packages for each of them separately. So I am thinking of a solution where there will be a common procedure/package for writing files to database through UTL_FILE which will accept couple of input parameters like below;
1) Header query parameter -> which will have query for column headers and will return one row.
2) Main query parameter -> which will have query for main/actual data and will return thousands of rows.
3) File name parameter -> which give path to system where file needs to be stored.
My challenge is I am unable to pass a query as parameters which will be fired and whatever result given will be written through utl_file. Basically first two parameters will be dynamic there will be NO constant number of columns defined.
Hope I have made myself clear.
Thanks in advance
Regards,
Ash