Обсуждение: fetch in embedded sql

Поиск
Список
Период
Сортировка

fetch in embedded sql

От
"Heinrich Retzlaw"
Дата:
hello,
i have written the following method for c++

bool DB::getPresentations(Presentations &pr)
{
        exec sql begin declare section;
                int     rID;
                char    pre[20];
        exec sql end declare section;

        rID = pr.roomID;

        exec sql BEGIN TRANSACTION;
        exec sql        DECLARE cur CURSOR FOR
                        SELECT  Presantation
                        FROM    Presantations
                        WHERE   RoomID=:rID;

        exec sql OPEN cur;

        // here
        exec sql FETCH FORWARD 1 IN cur INTO :pre;

        // and here
        exec sql CLOSE cur;
        exec sql COMMIT TRANSACTION;
}

if i start this method i get the following error belonging to the comments
"here" and "and here" in the code above

NOTICE:  current transaction is aborted, queries ignored until end of
transaction block
NOTICE:  current transaction is aborted, queries ignored until end of
transaction block

if i do the begin, declare cursor and fetch statement manually in the psql
database there is no error
thanks for every answer
best regards heinrich retzlaw