[sf-perl] Perl DBI => named pipe => sqlldr => Oracle table
David Fetter
david at fetter.org
Tue Jun 13 13:42:22 PDT 2006
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!
More information about the SanFrancisco-pm
mailing list