Do not use on any
shared computer
September 7, 2008 07:08pm pdt
 
[x]
Attachment Details

How to use External tables to load a file which has multiple record formats  and requires Multi-table insert

Tags: Oracle PL/SQL
I have an input  file with format as below
A header record with fixed position Fields (Header1)
A Sub header record with fixed position fields (Sub Header1)
A Detail record with fixed position fields (Multiple Detail records)
A sub trailer record with fixed position fields (Sub Trailer1)
A Sub header record with fixed position fields (Sub Header2)
A Detail record with fixed position fields (Multiple Detail records)
A sub trailer record with fixed position fields (Sub Trailer2)
A trailer record with fixed position Fields (Trailer1)
The above all repeats for another header : trailer record.  I want all the headers and trailers to go into a table, sub headers and subtrailers go into another table and all detail into another table. Total 3 tables.

Example:

H234234TEST  ojrfsj234242434302{sfl;mk;  (Header record)
S32wrsfwr23424 234242423 23423424234 (Sub Header record 1 )
D32wrsfwr23424 234242423 234234242342324 (Detail record)
X342342 223424v 452353453535355  (Sub trailer record1)
S5645764357646457457 (Sub Header record 2)
D32wrsfwr23424 234242423 234234242342324 (Detail record)
X342342 223424v 452353453535355  (Sub trailer record2)
T234252 43523346 56346435734747 (Trailer record)
Another Header to trailer batch would start ..like wise about 20 to 30 header to trailer in one file.

The first character represents whether it is a header or trailer or sub header or sub trailer or detail record.
All the header records are of fixed position format.
Like wise all the trailer records are of fixed position format.
Like wise all the sub header records are of fixed position format.
Like wise all the sub trailer records are of fixed position format.
Like wise all the detail records are of fixed position format.

In addition to above, in the data there might be some fields, where I would like to call a function to transform the data while loading.

Bascially all the header and trailer records need to go into a table,
Sub header and Sub trailer into another table
and Detail into another table.

I would need to create external tables to load such kind of data , basically the multi record format file to be loaded into multiple tables.  [Oracle database]
Could some one please let me know how to go about this?

Thanks a lot.
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Database
Question Asked By: gravindra1977
Solution Provided By: sdstuber
Participating Experts: 1
Solution Grade: A
Views: 18
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by sdstuber

Rank: Sage

Expert Comment by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by gravindra1977
Author Comment by gravindra1977:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by gravindra1977
Author Comment by gravindra1977:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by gravindra1977
Author Comment by gravindra1977:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by sdstuber

Rank: Sage

Expert Comment by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by gravindra1977
Author Comment by gravindra1977:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by sdstuber

Rank: Sage

Expert Comment by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by gravindra1977
Author Comment by gravindra1977:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by sdstuber

Rank: Sage

Expert Comment by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by gravindra1977
Author Comment by gravindra1977:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by sdstuber

Rank: Sage

Expert Comment by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by sdstuber

Rank: Sage

Accepted Solution by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by sdstuber

Rank: Sage

Expert Comment by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by gravindra1977
Author Comment by gravindra1977:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by sdstuber

Rank: Sage

Assisted Solution by sdstuber:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628