Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: sqlldr help

Re: sqlldr help

From: Jared Still <jkstill_at_cybcon.com>
Date: Thu, 17 May 2001 10:49:54 -0700
Message-ID: <F001.0030683E.20010517105040@fatcity.com>

Sounds like a job for Perl.

Here's an example of cleaning up this data before you send it to the database.

Really, this is much easier than doing it with PL/SQL or Java.

Jared



#!/usr/bin/perl

our %hashData;

while(<DATA>) {

        my($key, @data) = split(/\s/);
        if (defined($hashData{$key} ) ) {
                $hashData{$key} .= ' ' . join(' ',@data);
        } else {
                $hashData{$key} = join(' ',@data);
        }

}

foreach my $key ( sort keys %hashData ) {

        print "Key: $key - |$hashData{$key}|\n"; }

__DATA__
100 Memo line 1 information.
100 more information for record 100.
100 extra information again.
200 Memo for 200.
200 more info for 200
300 info for 300
300 next memo
300 and more
300 yet more again.


On Thursday 17 May 2001 10:45, Glenn Travis wrote:
> I have a data file that looks like this;

>

> 100 Memo line 1 information.
> 100 more information for record 100.
> 100 extra information again.
> 200 Memo for 200.
> 200 more info for 200
> 300 info for 300
> 300 next memo
> 300 and more
> 300 yet more again.
>

> I want to load to a table (col1, infodesc) to look like this;
>

> col1 infodesc
> ------ ------------
> 100 Memo line 1 information. more information for record 100. extra
> information again
> 200 extra information again. Memo for 200. more info for 200
> 300 info for 300 next memo and more yet more again.
>

> Can this be done with sqlldr or do I need to load the data as is and use
> PL/SQL (and cursor loops) to concatentate the data?
>
> thanks for any help!
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jared Still
  INET: jkstill_at_cybcon.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu May 17 2001 - 12:49:54 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US