On 12 Nov 2003 23:07:17 -0800
<snip>
*PLEASE* read the posting guidelines.
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
<snip>
I guess this is actually what you have, right?
---------------------------------------------------------------------
--
#this is a comment
$DW_dbh = DBI->connect("dbi:ODBC:TestIHLE", "TEST2", "TEST2")
or die "$DBI::errstr\n";
$hSel = $DW_dbh-> prepare ("select * from temptab");
$hSel->execute();
$rows=$hSel->fetchall_arrayref();
$hHosttab = $DW_dbh-> prepare ("insert into temptab values (?,?,?)");
#[here i have the Problem undef?]
$hHosttab->bind_param_array (1,$rows [0]);
#[here i have the Problem undef?]
$hHosttab->bind_param_array (2,$rows[1]);
#[here i have the Problem undef?]
$hHosttab->bind_param_array (3,$rows[2]);
$hHosttab->execute_array({ArrayTupleStatus => \my @tuple_status });
---------------------------------------------------------------------
------
Some may not think this is an efficent way to do this, but I do it
because it's more readable. Plus, the results of the query will not
return properly if the schema of the data source changes - which will
signal a change to the script.
Try (untested):
------------------------------------------------------------
$DW_dbh =
DBI->connect(
"dbi:ODBC:TestIHLE", "TEST2", "TEST2",
{RaiseError=>1}
)
or die "$DBI::errstr\n";
$hSel = $DW_dbh-> prepare ("select * from temptab");
#are you *sure* you want to select from temptab and then,
#insert the results into temptab - the *same* place the
#select results came from?
$hHosttab =
$DW_dbh-> prepare ("insert into temptab values (?,?,?)");
$hSel->execute();
#change the *_column_name" to the name of
#each column - for example:
#if the first column is "dog", then
#"$ref->{first_colum_name}" should read
#"$ref->{dog}"
while(my $ref = $fetchrow_hashref){
$hHosttab->execute(
"$ref->{first_colum_name}",
"$ref->{second_column_name}",
"$ref->{third_column_name",
{ArrayTupleStatus => \my @tuple_status }
);
}
------------------------------------------------------------
Notice that I coded for hash references versus array references. For
me, I prefer to use hash references, because I should *know* the
database schema - especially if I'm going to do inserts with the data
latter on. I'm not saying it's more efficent or that you can't use
array refererences - I do it because I can read easily what's going on
with the code.
You should consider changing the table name for the insert statement
you posted - unless you *like* infinite loops
HTH and does what you want it to do.
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL.
http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
"Dying is a very dull, dreary affair. And my advice to you is to
have nothing whatever to do with it." -- W. Somerset Maugham