plendid has asked for the wisdom of the Perl Monks concerning the following question:
I'm attempting to insert thousands of rows into a database table. Each row consists of one field. I believe that the fastest way to do this is with the DBI/execute_array function. But try as i might i can't seem to comprehend what it is that the DBI module expects.
I've attempted numerous coding permutations, googling perl execute_array, reading through the CPAN DBI documentation, Safari and ASPN. No luck. Can someone explain to me how to format the information in the following code to yield the desired result?
my @books = qw(1 2 3 4 5); my $sql = qq(insert into temp_selectedTitles values (?)); my $sh = $pics->prepare($sql); $sh->bind_param_array(1, [@books]); #this returns no rows my $tuples = $sh->execute_array({}, \@books); #this returns the error 'DBD::Oracle::st execute_array failed: 0 bind +values supplied but 1 expected...' my $tuples = $sh->execute_array({\ArrayTupleFetch=>$sh});
The desired result is five new database records,
table temp_selectedTitles book =========== 1 2 3 4 5
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI execute_array
by ikegami (Patriarch) on Feb 11, 2009 at 14:52 UTC | |
|
Re: DBI execute_array
by runrig (Abbot) on Feb 11, 2009 at 15:21 UTC | |
|
Re: DBI execute_array
by samtregar (Abbot) on Feb 11, 2009 at 16:53 UTC | |
by DamianKaelGreen (Acolyte) on Apr 23, 2014 at 17:20 UTC | |
|
Re: DBI execute_array
by tweetiepooh (Hermit) on Feb 11, 2009 at 17:37 UTC | |
|
Re: DBI execute_array
by roboticus (Chancellor) on Feb 11, 2009 at 20:39 UTC |