SQL Loader control file to create duplicate row
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: SQL Loader control file to create duplicate row

  1. #1
    Join Date
    Jul 2007
    Posts
    2

    SQL Loader control file to create duplicate row

    Hi all,

    I have data file like below,

    NF8,TLEV,F
    NF9,"EXPORT,UNLEADED",F
    NM2,"EXPORT,LEADED",C

    I need to import this data into table, whereas the secound& third row should be duplicated since it has internal comma's

    Final value in table should be,
    NF8 TLEV F
    NF9 EXPORT F
    NF9 UNLEADED F
    NM2 EXPORT C
    NM2 LEADED C

    Thanks for your suggestion and effort taken to think abt it , Any kind of ideas is welcomed

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    Can't do that using just SQL Loader

    Define the file as an external table, parse it via PL/SQL script -you might have to resort to cursors- and create your final table as desired.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  3. #3
    Join Date
    Jul 2007
    Posts
    2
    Thanks for early reply, looking forward to implement the same,
    but i have one more idea to add with it, please verify whether it is feasible,

    Like using simple select query can we,
    Split the single row into two row, whr one row with have substr() till comma,
    and other row from comma.

    if possible please update with code snippets for the same.

  4. #4
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    You had the idea, you do the coding.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

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