
mehuls
New User
Mar 3, 2011, 8:39 AM
Post #1 of 1
(2255 views)
|
|
Dereferencing array references
|
Can't Post
|
|
Hello I am a DBA, and not perl programmer. I am writing a small script to move data from one table to another (of course conditionally ) Below is the simplified version of the code i am using.
# Source my $db_sor = DBI->connect( "dbi:Oracle:DB1", "SOR", "SOR1" ) || die( $DBI::errstr . "\n" ); # Target my $db_tar = DBI->connect( "dbi:Oracle:DB2", "TAR", "TAR1" ) || die( $DBI::errstr . "\n" ); my $SEL = "SELECT COL1, COL2 FROM TEST_TAB"; my $INS = "INSERT INTO TEST_TAB_2 VALUES(?,?)"; my $sth_sor = $db_sor->prepare($SEL); my $sth_tar = $db_tar->prepare($INS); $sth_sor->execute(); while (my $rows = $sth_sor->fetchall_arrayref(undef, 3)) { ### Problem Statement ## $sth_tar->execute(???); ### for (@$rows) { print "got @$_\n"; } } My call to fetchall_arrayref returns be reference to array of references. I want to use this data to insert into tables in the target. I want to execute all the rows sent in single call to execute(for DB efficiency). Can not figure out how to de-reference here Please help Cheers Mehul S.
|