develooper Front page | perl.dbi.users | Postings from August 2006

Sample code of DBD::ODBC & SQLServer with CURSOR

From:
h-taguchi
Date:
August 9, 2006 01:11
Subject:
Sample code of DBD::ODBC & SQLServer with CURSOR
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



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About