RE: handling with variable

"Martin J. Evans" <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Organization Easysoft Ltd
Message-ID <[email protected]>
Not actually tested but the basic principle is:

my $dbh = DBI->connect(...);
my $sth = $dbh->prepare(q/select col1, col2 from table where col3=1/);
my ($col1, $col2);
$sth->bind_col(1, \$col1);
$sth->bind_col(2, \$col2);
$sth->fetch;
my $result = $col1 + $col2;
$sth = $dbh->prepare(q/insert into table2 values(?)/);
$sth->execute($result);

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com


On 04-Sep-2006 Ruprecht Helms wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> how can I work with variables within a perl-script using DBI.
> I want to read content of tablefields into variables to compute with it.
> The result of the computing should be written into another field of
> another table.
> 
> A little scriplet would be nice.
> 
> Regards,
> Ruprecht
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
> 
> iD8DBQFE/D5yOAckbBgiIFcRAhEBAJsHhtJ40n2iafcrGq/Oxu31tD+sowCeIeuO
> wG1LN7ZuIZcK9vN7orYVHnE=
> =ZHde
> -----END PGP SIGNATURE-----
> 
> -- 
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe:   
> http://lists.mysql.com/[email protected]

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.