Hello list!
I have run into problems trying to use SQLite via perl DBA.
According to the SQLite.org web site, DECLARE CURSOR should be supported
(actually, it is not in the list of the only SQL not supported).
I get a error saying "error near DECLARE".  I have tried to declare cursor
in many ways but always get the same error.
If "cursro" is not supported, does anybody have a suggestion on how to
achieve the same end?
################################# PERL
##############################################################
#         DECLARE CURSOR sar_cursor
#           AS SELECT * FROM cleanenv ORDER BY server
#           FOR UPDATE
    $dbh_s->do
        (q{
          DECLARE CURSOR sar_cursor
            FOR SELECT * FROM cleanenv ORDER BY server
      });
    $dbh_s->do
        (q{
          OPEN sar_cursor
      });
    $fetch = $dbh_s->prepare(q{FETCH NEXT FROM sar_cursor});


##
### Fetch rows
##
    while ($fetch->execute())
    {
        Data::Dumper::Dumper($fetch->fetchall_arrayref());

        $row = $fetch->fetchrow_arrayref;
### $dbh_s -> do("UPDATE cleanenv  SET xxx='???' WHERE CURRENT OF
$fetch->{CursorName}");
        last if $fetch->rows() < 10;
    }
    $dbh_s->do(q{CLOSE sar_cursor });
    $dbh_s->do(q{DEALLOCATE sar_cursor });

Regards,

Uriel Carrasquilla

Reply via email to