• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

external table

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any idea to put header and footer to one external table only according to its fix length?Thanks
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What kind of table? Database table? HTML table? PDF? What?
 
Jay jie
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oracle external table. External table will read data from fileABC.txt which fileABC have a dummy data.

 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not getting any answers in this forum... let's try the JDBC forum to see if anybody over there has any idea.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jay, your question is quite hard to comprehend. If you follow the TellTheDetails, or atually all of the HowToAskQuestionsOnJavaRanch advices (just click these links), you'll make it easier for fellow ranchers to answer your questions.

I've understood that your external file contains two types of records: 'H' and 'F'. You need to extract different columns at different positions for these two types of records - is that right?

If this is the case, there are (at least) two ways to do it. I'm not sure whether one is better than the other. I also assume you get this file from somewhere and do not create it on your own. If you create the file yourself, the best way would be to create two files instead, one containing only headers and the other containing only footers. It would take less processing by the database.

1) Create one external table. Let it have a column, say, TYPE at position 1:1, and another column to keep the rest of the record. Create two views which will select only rows of the desired type from the external table and use the SUBSTR function to extract proper columns for each of your views. If there are different columns than VARCHARs, use to_number or to_date (with proper formatting masks and/or decimal symbols) to convert them. Disadvantage is that badly formatted dates or numbers will not be rejected by the loading mechanism, you'll have to deal with them in your code the definition of the view.

2) Create two different external tables pointing to the same file. Declare one table to match records of type F and corresponding columns, and another table to match records of type H and corresponding columns. You can declare the columns in their proper type (number, date etc.) and have the records violating these types rejected.

Either way, you'll end up with two tables/views. It's actually the right way, since they're supposed to have different columns.

You had your syntax right, so I assume these pointers will suffice to you, but if this is not all that clear, I can elaborate a little bit
 
Jay jie
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually i only want header and footer to one external table only.
 
Martin Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to help, but you really need to TellTheDetails. Give us a specification of the file format you want to access as an external table, or at least post the contents of that file (a few lines covering all relevant cases would suffice). Tell us what the resulting table should look like (which columns should it have and what should they contain for different types of records).

Or, at the very least, answer the question from my previous post:

I've understood that your external file contains two types of records: 'H' and 'F'. You need to extract different columns at different positions for these two types of records - is that right?


reply
    Bookmark Topic Watch Topic
  • New Topic