CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Dereferencing array references

 



mehuls
New User

Mar 3, 2011, 8:39 AM

Post #1 of 1 (2831 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.


Code
# 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 Frown
Please help

Cheers
Mehul S.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives