SQL Loader with Header & Trailer
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: SQL Loader with Header & Trailer

  1. #1
    Join Date
    Jul 2001
    Posts
    334
    Hi all,
    I have a flat file with the following format, In the beginning 1 Header Record, In the End 1 Trailer Record and in the middle Detail Records.

    For example See Below
    H
    D
    D
    D
    D
    T

    Now the problem is how I can load into the table? I know I have to use SQL loader and I can load one flat file without Header & Trailer But what if I have every thing in one file? What techniques I will use perform this task.

    Thanks in advance
    Aph.

  2. #2
    Join Date
    Apr 2002
    Location
    Germany.Laudenbach
    Posts
    448
    Hi;

    This link may give you the answer, it should be possbile to load data conditionally depending on content of the row:

    http://www.orafaq.com/faqloadr.htm#SELECTIVE

    Orca

  3. #3
    Join Date
    Jul 2001
    Posts
    334
    Thanks Ora 777,

    The website you provide it is really helpful, but if you see my original post, what I need to load Header, Detail and Trailer data. Now the confusion is do I have to create 3 tables one for header, one for Detail and one for Trailer
    OR
    Do I have to create only 1 table but if one table than the content of Header,Detail and Trailer are totally different with each other? This is point where I am confused. Sounds like should I create 3 table and using the conditional SQL*Loader I will load Header data from flat file into Header table, Detail data into Detail table and trailer data into Trailer table, But if this is the case how I can check/condition for Header, Detail and Trailer.
    Example of flat file:

    HSONY INC062102
    D001ABC
    D002MNG
    D003GKI
    D004KLM
    T00901287A

    First line is Header start with H, Detail lines start with D and Trailer data start with T. (Each line start with tag H, D and T)

    Once again I need help to resolve the issue. Thanks in advance.

    Regards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width