Problem with selecting rows from a database link
am 17.09.2007 22:42:42 von Rainaldo.Crosbourne------_=_NextPart_001_01C7F96B.4B57F7AA
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hey guys
=20
I am trying to query a table using a database link, using the following
code:
=20
use strict;
=20
use DBI;
=20
my $col_value =3D 'test';
my $query =3D 'select col_1,col_2,col_3 from table_name@link_name where
col_1 =3D ?';
=20
my $dbh =3D DBI ->connect ('dbi:Oracle:dbs','username','password',{
RaiseError =3D> 1, AutoCommit =3D> 0 }) || die "Database connetion not =
made:
$DBI::errstr";
=20
my $sth =3D $dbh->prepare ($query)|| die "Unable to prepare\n";
=20
$sth->execute($col_value) or die "Can't execute SQL statement:
$DBI::errstr Stopped\n";
my ($col_1,$col_2,$col_3);=20
=20
$sth->bind_columns(\($col_1,$col_2,$col_3))||die "Unable to fetch\n";
=20
print "$col_1: $col_2 :$col_3\n" while $sth1->fetchrow_arrayref;
=20
$dbh->disconnect;
=20
Now what happens is that, the first time this program is run, it returns
the correct result. However after the first successful run it fails to
run again. It gives NO error, it just fails to return the rows. If a
create a new link and use the new link in the query, it then works for
the first run, and then fails after. The same thing happens if I decide
to query a view that was created using the link.=20
=20
The link is connected to a 9I database.
Perl version: 5.8.6
DBI version =3D 1.59
DBD:Oracle =3D 1.19
=20
Regards,
Ray
------_=_NextPart_001_01C7F96B.4B57F7AA--