Subject: | misbehaviour of scrollable cursors |
Two problems with scrollable cursors (with DBD::Oracle v1.42, OCI
version 11.2.0.2)
Given the following :
my $sql = "SELECT table_name FROM all_tables ORDER BY table_name ";
my $sth = $dbh->prepare($sql, {ora_exe_mode =>
OCI_STMT_SCROLLABLE_READONLY});
$sth->execute;
Problem 1 :
$sth->ora_fetch_scroll(OCI_FETCH_ABSOLUTE, $some_offset);
my $r1 = $sth->ora_fetch_scroll(OCI_FETCH_NEXT, 0);
my $r2 = $sth->ora_fetch_scroll(OCI_FETCH_NEXT, 0);
$r2 is a different reference from $r1, but the content of @$r1
is overwritten with the content of @$r2 !
Problem 2 :
$sth->ora_fetch_scroll(OCI_FETCH_ABSOLUTE, $some_offset);
my $r1 = $sth->fetch;
my $r2 = $sth->fetch;
...
Every successive call to the ->fetch() method always returns the same
record. And of course, if you try $sth->fetchall_arrayref(), you get
into an infinite loop. However, if you do one single OCI_FETCH_NEXT
after the ABSOLUTE, then the behaviour of ->fetch() seems to be OK.