Hi,

I need to update a mysql table with values contained in an oracle table. For
this, I am using the perl dbi, but am not getting the syntax right. I am
able to get the syntax for updating a mysql table from another mysql table
contained in the same database. But  I am not able to update the mysql table
from the oracle table or even from another mysql table in a different mysql
database.

To simulate my problem, I created a table called 'family_master' in a mysql
database called 'jag', and another table called 'names' in a mysql database
called 'sush'. Both the tables contain just 2 fields each - name and
serial_number. I have input the names and serial_numbers in the
family_master table and just the names in the names table. I am now trying
to update the  serial_numbers in the  names table from the family_master
table with the following piece of code:

use warnings;
use strict;

my ($dbh1,$dbh2);

#CONNECT TO MYSQL
#================

use DBI;

$dbh1 =DBI->connect ('dbi:mysql:jag','jag','passwd') || die "couldn't
connect: $DBI::errstr\n";

$dbh2 =DBI->connect ('dbi:mysql:sush','jag','passwd') || die "couldn't
connect: $DBI::errstr\n";

$dbh2->do("update names n, family_master f
                set n.serial_number = f.serial_number
                  where n.name = f.name");

$dbh1->disconnect();

$dbh2->disconnect();


If I use $dbh1 in the 'do' statement, it says that the jag.names table
doesn't exist.
If I use $dbh2 in the 'do' statement, it says that the
sush.family_mastertable doesn't exist.
How can I reference the two tables  from two different database handles in
the same statement?
I have searched the book 'Programming the Perl DBI' but haven't succeeded in
finding an answer.

jagdish eashwar
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to