Was reading through a listserver group that I am subscribed to, and a question prompted me to repost this information. It is in fact included in the Email Utility that I have here, but thought it worth posting on its own as well. I cannot remember where I found the original code of this file dump utility, however, originally it was accompanied by a dump_fixed routine as well. I later enhanced the overall into a single API call with additional features such as :
- User Defined Separator
- Optional Header Inclusion
- Optional Trailing Separator
- User Defined Maximum Line Size
- Write and Append Modes
It provides a very easy means of writing out a flat file from data source. Much easier than making all of those UTL_FILE.PUT statements... all reduced down to a single API call... simply by passing your SQL. The SQL itself can be generated dynamically. Take note also that we include the standard, and ever important, exceptions to address key errors that may potentially occur. Depending upon your usage, you might alter the exception handler so that it raises the error and propogates it out instead of just displaying the information.
Another interesting benefit is that it provides a good example of how you can dynamically identify columns that belong to a table, and then utilize that information sourced.
Pages: 1· 2


