hi, I have to extract the data from several tables (Oracle is the database) and insert them into a file, in a specified format.
Each column will be allocated a certain size (filled with empty spaces if size is too big), and I will assign a line for each record extracted from the tables. There wont be any delimiter. Example of such line: column1 colum2column2 column4 etc
So i am looking for ways to do it in Java, of course. Thanks in advance for your suggestions and ideas.
thanks, but i would like to find a more elegant way to do it. I kind of had it with pure SQL statements now, I was thinking about using Hibernate, but I think the learning curve is too important and I have a short time left to complete my task.
I am still open to new suggestions and ideas
author & internet detective
The hard part is figuring out column widths. I've done all of these at one time or another: derive the size from the column metadata, run through the data once to get the longest value for each column then run through again to report, use an external metadata file to specify column sizes. The external metadata gives you a chance to specify nice headings, too.
Any of those sound good? There are some open source packages that make columnar reports from result sets using only the column metadata. I made a primitive one of those that leaves a column blank if its the same value as the row before, making hierarchical data into an outline appearance.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi