[sf-perl] Perl DBI => named pipe => sqlldr => Oracle table

Loo, Peter # PHX Peter.Loo at source.wolterskluwer.com
Tue Jun 13 15:35:05 PDT 2006


Thanks a bunch David.  Excellent advise.
 
Peter

-----Original Message-----
From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org
[mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or
g] On Behalf Of David Fetter
Sent: Tuesday, June 13, 2006 1:42 PM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] Perl DBI => named pipe => sqlldr => Oracle table

On Tue, Jun 13, 2006 at 10:36:32AM -0700, Loo, Peter # PHX wrote:
> Hello All,
>  
> I have the need to spawn two processes within Perl and was wondering 
> if someone can show me the way.

I think you're overthinking this.

Make a control file that looks something like this:

LOAD DATA
    INFILE "-"
    INTO TABLE legacy_system
    FIELDS TERMINATED BY "Ahnold Governator"
        OPTIONALLY ENCLOSED BY '"'
    INTO TABLE smells_like_teen_spirit
    (here, we, are, now, entertain, us)

in it, then use a standard pipe open like this:

open($sqlldr, '|sqlldr
scott/tiger at omgwtf.i.am.so.glad.i.do.not.use.oracle.any.more.com
control=your.ctl')
    or die "Can't open SQL*Loader.  Use PostgreSQL instead ;)";

and start print()ing to $sqlldr instead of STDOUT.

When you're done, close $sqlldr, and you're good to go[1].

HTH :)

Cheers,
D

[1] Well, as good as you can be and still use a legacy system like
Oracle ;)
--
David Fetter <david at fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666
                              Skype: davidfetter

Remember to vote!
_______________________________________________
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
http://mail.pm.org/mailman/listinfo/sanfrancisco-pm


This E-mail message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not
the intended recipient, please contact the sender by reply E-mail, and
destroy all copies of the original message.


More information about the SanFrancisco-pm mailing list