Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: using stdin with sqlldr

by runrig (Abbot)
on Nov 20, 2015 at 22:06 UTC ( [id://1148268]=note: print w/replies, xml ) Need Help??


in reply to using stdin with sqlldr

New answer to an old post, but here's an example of loading to a table using (brand new module as of this post) DBIx::BulkUtil. This library can do the traditional "load from a file", or you can create a function to generate and return the rows of data (or pass in your own file handle for sqlldr to read) to be fed to sqlldr through stdin:
my ($dbh, $dbu) = DBIx::BulkUtil->ora_connect( Database => $database, User => $user, Password => $pw, ); # Assuming two column table # Default is "|" column delimited, "\n" row delimited my @rows = qw( abc|def ghi|jkl ); sub insert_row { my $data = shift @rows or return; return $data . "\n"; } $dbu->bcp_in($table, '-', { Stdin => \&insert_row, }); $dbh->disconnect();

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1148268]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-24 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found