Sample code of DBD::ODBC & SQLServer with CURSOR

Sample code of DBD::ODBC & SQLServer with CURSOR

am 09.08.2006 10:11:05 von h-taguchi

Hello,

Someone can point out a sample code of DBD::ODBC & SQLServer with CURSOR?
I can fetch records without cursor, but I like to update the first record
gotten with cursor.

OK without CURSOR:

my $stmt = "SELECT * FROM KT..MyTable";
my $sthSEL = $dbh->prepare($stmt);
$sthSEL->execute();
my @row = $sthSEL->fetchrow_array;

Error with CURSOR:

my $stmt = "DECLARE c1 CURSOR FOR SELECT * FROM KT..MyTable";
my $sthCUR = $dbh->prepare($stmt);
$sthCUR->execute();
my $sthSEL= $dbh->prepare("OPEN c1");
$sthSEL->execute();
my @row = $sthSEL->fetchrow_array;

---> DBD::ODBC::st fetchrow_array failed: (DBD: no
select statement currently executing err=-1)

h-taguchi@secom