develooper Front page | perl.beginners | Postings from February 2002

Inserting and array into an Oracle db

Thread Next
McElwee, Shane
February 6, 2002 15:12
Inserting and array into an Oracle db
Message ID:

I'm capturing data from a proprietary database to a flat file and I want to
create tables and insert rows of data into those tables. From what I've read
as long as the number of columns matches the number of elements in a row I
should be able to do wholesale inserts into the oracle database. I just need
direction on how best to approach this. I was thinking of using a sql
statement of the order:

     @row = $sth->dump_results(80, "\n", ':',\*CONTENT);

      foreach $x (@row){
        $sql = "insert into $i values($x);
        $sth = $dbh2->prepare($sql);
        $sth->execute or die "Can't execute SQL statement: ",
$sth->errstr(), "\n";

I know this won't work but am I moving in the right direction? Should I be
using fetchrow_arrayref() to reference the rows? How would I use this in a
sql statement? Perhaps I'm moving down a cul de sac, so any pointers in the
right direction would be appreciated.



Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About